check/2 |
Check for the presence of Key in Bloom . |
check_and_set/2 |
Record the presence of Key in Bloom or ForgetfulBloom
and return whether it was present before. |
clear/1 | Clear all of the bits in the filter, removing all keys from the set. |
deserialize/1 | Deserialize a previously serialized bloom filter back into a bloom filter reference. |
new/2 | Create a new bloom filter structure. |
new_forgetful/4 | Create a new forgetful bloom filter structure. |
new_forgetful_optimal/4 | Create a new forgetful bloom filter structure. |
new_optimal/2 | Create a new bloom filter structure. |
serialize/1 | Serialize a bloom filter to binary. |
set/2 |
Record the presence of Key in Bloom and ForgetfulBloom
For ForgetfulBloom a boolean is returned to indicate if the value was already present (like check_and_set/2 ). |
type/1 | Get type of filter. |
check(Bloom::bloom_nif:bloom() | bloom_nif:serialized_bloom(), Key::term()) -> boolean()
Check for the presence of Key
in Bloom
.
Serialized and binary encoded bloom filters can be used with this
function when you wish to check for the key and do not need to use set
(eg. a static bloom filter stored in a database).
check_and_set(Bloom::bloom_nif:bloom(), Key::term()) -> boolean()
Record the presence of Key
in Bloom
or ForgetfulBloom
and return whether it was present before.
clear(Bloom::bloom_nif:bloom()) -> ok
Clear all of the bits in the filter, removing all keys from the set.
deserialize(SerializedBloom::bloom_nif:serialized_bloom()) -> {ok, bloom_nif:bloom()}
Deserialize a previously serialized bloom filter back into a bloom filter reference.
new(BitmapSize::pos_integer(), ItemsCount::pos_integer()) -> {ok, Bloom::bloom_nif:bloom()}
Create a new bloom filter structure.
BitmapSize
is the size in bytes (not bits) that will be allocated in memory
ItemsCount
is an estimation of the maximum number of items to store.
new_forgetful(BitmapSize::pos_integer(), ItemsCount::pos_integer(), NumFilters::pos_integer(), RotateAfter::pos_integer()) -> {ok, Bloom::bloom_nif:bloom()}
Create a new forgetful bloom filter structure.
BitmapSize
is the size in bytes (not bits) that will be allocated in memory
ItemsCount
is an estimation of the maximum number of items to store,
NumFilters
is the number of filters to maintain (minimum of 3) and
RotateAfter
is how many insertions to do into a filter before rotating a blank filter into the future
position.
new_forgetful_optimal(ItemsCount::pos_integer(), NumFilters::pos_integer(), RotateAfter::pos_integer(), FalsePositiveRate::float()) -> {ok, Bloom::bloom_nif:bloom()}
Create a new forgetful bloom filter structure.
BitmapSize
is the size in bytes (not bits) that will be allocated in memory
ItemsCount
is an estimation of the maximum number of items to store,
NumFilters
is the number of filters to maintain (minimum of 3) and
RotateAfter
is how many insertions to do into a filter before rotating a blank filter into the future
position.
FalsePositiveRate
is the wanted rate of false positives, in [0.0, 1.0].
new_optimal(ItemsCount::pos_integer(), FalsePositiveRate::float()) -> {ok, Bloom::bloom_nif:bloom()}
Create a new bloom filter structure.
ItemsCount
is an estimation of the maximum number of items to store.
FalsePositiveRate
is the wanted rate of false positives, in [0.0, 1.0].
serialize(Bloom::bloom_nif:bloom()) -> {ok, bloom_nif:serialized_bloom()}
Serialize a bloom filter to binary.
check/2
can be used against this serialized form efficiently.
set(Bloom::bloom_nif:bloom(), Key::term()) -> ok | boolean()
Record the presence of Key
in Bloom
and ForgetfulBloom
For ForgetfulBloom
a boolean is returned to indicate if the value was already present (like check_and_set/2
).
type(Bloom::bloom_nif:bloom()) -> number() | {error, Reason::binary()}
Get type of filter.
Generated by EDoc