Skip to content

Commit 9182b75

Browse files
committed
Changes based on feedback for bloom commands and documentation
Signed-off-by: zackcam <[email protected]>
1 parent 1f892b9 commit 9182b75

File tree

12 files changed

+64
-39
lines changed

12 files changed

+64
-39
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ for generating content for the website and man pages.
77

88
This repo comes with a Makefile to build and install man pages.
99

10-
make VALKEY_ROOT=path/to/valkey
10+
make VALKEY_ROOT=path/to/valkey VALKEY_BLOOM_ROOT=path/to/valkey-bloom
1111
sudo make install INSTALL_MAN_DIR=/usr/local/share/man
1212

1313
Prerequisites: GNU Make, Python 3, Python 3 YAML (pyyaml), Pandoc.
14-
Additionally, the scripts need access to the valkey code repo,
14+
Additionally, the scripts need access to the valkey and valkey-bloom code repos,
1515
where metadata files about the commands are stored.
1616

1717
The pages are generated under `_build/man/` by default. The default install

commands/bf.add.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Adds an item to a bloom filter, if the specified bloom filter does not exist creates a bloom filter with default configurations with that name.
1+
Adds a single item to a bloom filter. If the specified bloom filter does not exist, a bloom filter is created with the provided name with default properties.
22

3-
If you want to create a bloom filter with non-standard options, use the `BF.INSERT` or `BF.RESERVE` command.
3+
To add multiple items to a bloom filter, you can use the BF.MADD or BF.INSERT commands.
4+
5+
If you want to create a bloom filter with non-default properties, use the `BF.INSERT` or `BF.RESERVE` command.
46

57
## Examples
68

commands/bf.card.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Gets the cardinality of a Bloom filter - number of items that have been successfully added to a Bloom filter.
1+
Returns the cardinality of a Bloom filter which is the number of items that have been successfully added to it.
22

33
## Examples
44

@@ -7,6 +7,6 @@ Gets the cardinality of a Bloom filter - number of items that have been successf
77
1
88
127.0.0.1:6379> BF.CARD key
99
1
10-
127.0.0.1:6379> BF.CARD missing
10+
127.0.0.1:6379> BF.CARD nonexistentkey
1111
0
1212
```

commands/bf.exists.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
Determines if an item has been added to the bloom filter.
1+
Determines if an item has been added to the bloom filter previously.
22

33
A Bloom filter has two possible responses when you check if an item exists:
44

5-
* "No" (Definite) - If the filter says an item is NOT present, this is 100% certain. The item is definitely not in the set.
6-
7-
* "Maybe" (Probabilistic) - If the filter says an item IS present, this is uncertain. There's a chance it's a false positive. The item might be in the set, but may not be
5+
* 0 - The item definitely does not exist since with bloom filters, false negatives are not possible.
86

7+
* 1 - The item exists with a given false positive (fp) percentage. There is an fp rate % chance that the item does not exist. You can create bloom filters with a more strict false positive rate as needed.
98

109
## Examples
1110

@@ -14,6 +13,6 @@ A Bloom filter has two possible responses when you check if an item exists:
1413
1
1514
127.0.0.1:6379> BF.EXISTS key val
1615
1
17-
127.0.0.1:6379> BF.EXISTS key missing
16+
127.0.0.1:6379> BF.EXISTS key nonexistent
1817
0
1918
```

commands/bf.info.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
Returns information about a bloom filter
1+
Returns usage information and properties of a specific bloom filter
22

33
## Info Fields
44

5-
* CAPACITY - Returns the number of unique items that would need to be added before scaling would happen
6-
* SIZE - Returns the number of bytes allocated
5+
* CAPACITY - The number of unique items that would need to be added before a scale out occurs or (non scaling) before it rejects addition of unique items.
6+
* SIZE - The number of bytes allocated by this bloom filter.
77
* FILTERS - Returns the number of filters in the specified key
8-
* ITEMS - Returns the number of unique items that have been added the the bloom filter
9-
* ERROR - Returns the false positive rate for the bloom filter
10-
* EXPANSION - Returns the expansion rate
8+
* ITEMS - The number of unique items that have been added to the bloom filter
9+
* ERROR - The false positive rate of the bloom filter
10+
* EXPANSION - The expansion rate of the bloom filter. Non scaling filters will have an expansion rate of nil.
1111
* MAXSCALEDCAPACITY - Returns the maximum capacity that can be reached before an error occurs
1212

1313
If none of the optional fields are specified, all the fields will be returned. MAXSCALEDCAPACITY will be an unrecognized argument on non scaling filters

commands/bf.insert.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
Creates a bloom filter with the specified parameters. If a parameter is not specified then the default value will be used. If ITEMS is specified then it will also attempt to add all items specified
1+
If the bloom filter does not exist under the specified name, a bloom filter is created with the specified parameters. Default properties will be used if the options below are not specified.
2+
3+
When the ITEMS option is provided, all items provided will be attempted to be added.
24

35
## Insert Fields
46

5-
* CAPACITY capacity - capacity for the initial bloom filter
6-
* ERROR `fp_error` - The false positive rate for the bloom filter
7-
* EXPANSION expansion - The expansion rate for a scaling filter
7+
* CAPACITY `capacity` - The number of unique items that would need to be added before a scale out occurs or (non scaling) before it rejects addition of unique items.
8+
* ERROR `fp_error` - The false positive rate of the bloom filter
9+
* EXPANSION `expansion` - This option will specify the bloom filter as scaling and controls the size of the sub filter that will be created upon scale out / expansion of the bloom filter.
810
* NOCREATE - Will not create the bloom filter and add items if the filter does not exist already
911
* TIGHTENING `tightening_ratio` - The tightening ratio for the bloom filter
10-
* SEED seed - The seed the hash functions will use
11-
* NONSCALING - Will make it so the filter can not scale
12-
* VALIDATESCALETO `validatescaleto` - Checks if the filter could scale to this capacity and if not show an error and don’t create the bloom filter
13-
* ITEMS item - One or more items we will add to the bloom filter
12+
* SEED `seed` - The seed the hash functions will use
13+
* NONSCALING - This option will configure the bloom filter as non scaling; it cannot expand / scale beyond its specified capacity.
14+
* VALIDATESCALETO `validatescaleto` - Validates if the filter can scale out and reach to this capacity based on limits and if not, return an error without creating the bloom filter
15+
* ITEMS `item` - One or more items to be added to the bloom filter
1416

1517
Due to the nature of NONSCALING and VALIDATESCALETO arguments, specifying NONSCALING and VALIDATESCALETO isn't allowed
1618

@@ -20,7 +22,7 @@ Due to the nature of NONSCALING and VALIDATESCALETO arguments, specifying NONSC
2022
127.0.0.1:6379> BF.INSERT key ITEMS item1 item2
2123
1) (integer) 1
2224
2) (integer) 1
23-
# This does not update the capcity but uses the origianl filters values
25+
# This does not update the capacity since the filter already exists. It only adds the provided items.
2426
127.0.0.1:6379> BF.INSERT key CAPACITY 1000 ITEMS item2 item3
2527
1) (integer) 0
2628
2) (integer) 1

commands/bf.load.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Loads a bloom filter from a dump of an existing bloom object with all the properties and bit vector dump.
1+
Restores a bloom filter from a dump of an existing bloom filter with all of its specific the properties and bit vector dump of sub filter/s. This command is only generated during AOF Rewrite to restore a bloom filter in the future.

commands/bf.madd.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Adds one or more items to a Bloom Filter, if the bloom filter does not exist creates a default bloom filter.
1+
Adds one or more items to a bloom filter. If the specified bloom filter does not exist, a bloom filter is created with the provided name with default properties
22

3-
If you want to create a bloom filter with non-standard options, use the `BF.INSERT` or `BF.RESERVE` command.
3+
If you want to create a bloom filter with non-default properties, use the `BF.INSERT` or `BF.RESERVE` command.
44

55
## Examples
66

commands/bf.mexists.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
Determines if one or more items has been added to a bloom filter.
1+
Determines if the provided item/s have been added to a bloom filter previously.
22

33
A Bloom filter has two possible responses when you check if an item exists:
44

5-
* "No" (Definite) - If the filter says an item is NOT present, this is 100% certain. The item is definitely not in the set.
5+
* 0 - The item definitely does not exist since with bloom filters, false negatives are not possible.
66

7-
* "Maybe" (Probabilistic) - If the filter says an item IS present, this is uncertain. There's a chance it's a false positive. The item might be in the set, but may not be
7+
* 1 - The item exists with a given false positive (fp) percentage. There is an fp rate % chance that the item does not exist. You can create bloom filters with a more strict false positive rate as needed.
88

99
## Examples
1010

commands/bf.reserve.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
Creates an empty bloom object with the capacity and false positive rate specified
1+
Creates an empty bloom filter with the capacity and false positive rate specified. By default, a scaling filter is created with the default expansion rate.
2+
3+
To specify the scaling / non scaling nature of the bloom filter, use the options: NONSCALING or SCALING <expansion rate>. It is invalid to provide both options together.
24

35
## Reserve fields
46

5-
* error_rate - The false positive rate the bloom filter will be created with
6-
* capacity - The starting capacity the bloom filter will be created with
7-
* EXPANSION expansion - The rate in which filters will increase by
8-
* NONSCALING - Setting this will make it so the bloom object can’t expand past its initial capacity
7+
* error_rate - The false positive rate of the bloom filter
8+
* capacity - The number of unique items that would need to be added before a scale out occurs or (non scaling) before it rejects addition of unique items.
9+
* EXPANSION expansion - This option will specify the bloom filter as scaling and controls the size of the sub filter that will be created upon scale out / expansion of the bloom filter.
10+
* NONSCALING - This option will configure the bloom filter as non scaling; it cannot expand / scale beyond its specified capacity.
911

1012
## Examples
1113

0 commit comments

Comments
 (0)