StoqBloomFilter

Overview

Examples

class stoq.filters.StoqBloomFilter
backup_scheduler(interval)

Set a syncing schedule for the persistent bloom filter

Parameters:interval (int) – Interval between syncing bloom filter to disk
create_filter(filepath, size, falsepos_rate)

Create new bloom filter

Parameters:
  • filepath (bytes) – Path to persistent bloom filter on disk
  • size (int) – Maximum number of elements in bloom filter
  • falsepos_rate (float) – Maximum false positive probability
import_filter(filepath)

Load a previously created persistent bloom filter

Parameters:filepath (bytes) – Path to persistent bloom filter on disk
query_filter(item, add_missing=False)

Identify whether an item exists within filter or not

Parameters:
  • item (bytes) – Item to query the bloom filter with
  • add_missing (bool) – If set to True, the item will be added to the bloom filter if it doesn’t exist
Returns:

True if item exists, False if not.

Return type:

bool