A bloom filter that will decay old values and scale up capacity as needed. This bloom filter will automatically decay values such that an item added will be removed from the bloom after decay_time seconds. The underlying bloom has initial capacity capacity and maximum error error. In addition, the bloom will automatically scale using Almeida’s method from “Scalable Bloom Filters” using an error tightening ratio and growth factor given by error_tightening_ratio and growth_factor. A bloom filter will be scaled up when approximatly max_fill_factor percent of the capacity of the bloom filter are in use. Conversely, the bloom will be scaled down if there is one bloom left and it has a fill percentage less than min_fill_factor. Together, these two fill factor conditionals attempt to keep the scaling bloom at the right size for the current stream of data.
Parameters: |
|
---|
Add key to the bloom filter and scale if necissary. The key will be inserted at the current timestamp if parameter timestamp is not provided.
Parameters: |
|
---|
Check if key is contained in the bloom filter
Parameters: | key (str) – key to be added |
---|---|
Return type: | bool |
Decay the bloom filter and remove items that are older than decay_time. This will also remove empty bloom filters.
Return the current expected error rate from the blooms. This should always be smaller than the maximum error given in the constructor.
Return type: | float |
---|
Reads the bloom from the given file f.
Parameters: | f (file) – File to save the bloom filter to |
---|---|
Return type: | ScalingTimingBloomFilter |
Set a new IOLoop to attatch the decay operation to. stop() should be called before changing the ioloop.
Parameters: | ioloop (tornado.ioloop.IOLoop or None) – an instance of an IOLoop to attatch the periodic decay operation to |
---|
Returns the approximate size of the current bloom state.
Return type: | float |
---|
Start a periodic callback on the IOLoop to decay the bloom at every half decay_time.
Stop the periodic decay operation
Saves the current bloom to the file object f.
Parameters: | f (file) – File to save the bloom filter to |
---|