Adding optional arg to BF.INSERT to allow users to check if their bloom filter can reach the desired size #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR is proposing to add an extra optional arg to the BF.INSERT command or create a new command in order to allow users to know if their creation will be able to scale to what they desire. For option 1, we would add an optional arg called “ATLEASTCAPACITY” and validate whether it is possible to achieve X capacity given the bloom object memory usage limit (by default 128MB), fp rate, Tightening, expansion, and scale outs. For option 2 we will add a new command that would output the capacity that can be reached before having an error thrown from scaling out given the bloom object memory usage limit (by default 128MB), fp rate, Tightening, expansion.
Option 1: Amend the BF.INSERT command
Adding ATLEASTCAPCITY as an optional arg of BF.INSERT. This argument would allow the user to specify what they think their filter will scale up to. If the capacity that they think it will scale to isn't viable given the specifications provided then we will throw an error. New bf.insert command will look like:
Other name proposals for ATLEASTCAPACITY name:
There are three new error messages associated with this:
Note: the user specifying NONSCALING and ATLEASTCAPACITY isn't allowed as this new argument is only useful for seeing if a filter can scale to the desired capacity.
Option 2: Create a new command BF.GETMAXCAPACITY
This would check what the max capacity of a bloom filter is given a capacity, error rate and expansion. This command will look like:
This command would then output the capacity that could be reached before having an error thrown from scaling out. This would not create a filter given the specified arguments.
Testing
Added checks for these three error messages in
test_bloom_command.py
If we choose to implement option two will create new tests for this.