bloom-sol 0.0.3

Counting bloom filter, aimed for solana
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::bloom_sol::struct_def::CountingBloomFilter;

impl CountingBloomFilter {
    /// Creates a new CountingBloomFilter.
    ///
    /// - `size`: The number of counters (should be chosen based on expected number of elements and false positive rate).
    /// - `num_hashes`: The number of hash functions to use (typically 3-7 for good performance).
    pub fn new(size: usize, num_hashes: usize, boolean_counting: bool) -> Self {
        CountingBloomFilter {
            counters: vec![0; size],
            size,
            num_hashes,
            boolean_counting,
        }
    }
}