mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
Add new BiF for low-level Bloom filter initialization.
For symmetry reasons, the new Bif bloomfilter_basic_init2 also allows users to manually specify the memory bounds and number of hash functions to use.
This commit is contained in:
parent
8ca76dd4ee
commit
d50b8a147d
4 changed files with 67 additions and 12 deletions
|
@ -17,6 +17,8 @@ error: false-positive rate must take value between 0 and 1
|
|||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
3
|
||||
|
|
|
@ -15,6 +15,13 @@ function test_basic_bloom_filter()
|
|||
bloomfilter_add(bf_cnt, 0.5); # Type mismatch
|
||||
bloomfilter_add(bf_cnt, "foo"); # Type mismatch
|
||||
|
||||
# Alternative constructor.
|
||||
local bf_dbl = bloomfilter_basic_init2(4, 10);
|
||||
bloomfilter_add(bf_dbl, 4.2);
|
||||
bloomfilter_add(bf_dbl, 3.14);
|
||||
print bloomfilter_lookup(bf_dbl, 4.2);
|
||||
print bloomfilter_lookup(bf_dbl, 3.14);
|
||||
|
||||
# Basic usage with strings.
|
||||
local bf_str = bloomfilter_basic_init(0.9, 10);
|
||||
bloomfilter_add(bf_str, "foo");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue