Module bloom_nif

This is a NIF wrapper around https://crates.io/crates/bloomfilter, a simple but fast Bloom filter implementation, that requires only 2 hash functions, generated with SipHash-1-3 using randomized keys.

Description

This is a NIF wrapper around https://crates.io/crates/bloomfilter, a simple but fast Bloom filter implementation, that requires only 2 hash functions, generated with SipHash-1-3 using randomized keys.

Data Types

bloom()

abstract datatype: bloom()

serialized_bloom()

serialized_bloom() = binary()

Function Index

check/2Check for the presence of Key in Bloom.
check_and_set/2Record the presence of Key in Bloom and return whether it was present before.
clear/1Clear all of the bits in the filter, removing all keys from the set.
deserialize/1Deserialize a previously serialized bloom filter back into a bloom filter reference.
ftype/1Get type of filter.
new/1Create a new filter structure.
serialize/1Serialize a bloom filter to Erlang terms.
set/2Record the presence of Key in Bloom.

Function Details

check/2

check(SerializedBloom::bloom() | 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/2

check_and_set(Bloom::bloom(), Key::term()) -> boolean()

Record the presence of Key in Bloom and return whether it was present before.

clear/1

clear(Bloom::bloom()) -> ok

Clear all of the bits in the filter, removing all keys from the set.

deserialize/1

deserialize(SerializedBloom::serialized_bloom()) -> {ok, bloom()}

Deserialize a previously serialized bloom filter back into a bloom filter reference.

ftype/1

ftype(_Ref::bloom()) -> number() | {error, Reason::binary()}

Get type of filter

new/1

new(_Opts::map) -> {ok, Bloom::bloom()} | {error, Reason::binary()}

Create a new filter structure.

serialize/1

serialize(Bloom::bloom()) -> {ok, serialized_bloom()}

Serialize a bloom filter to Erlang terms. check/2 can be used against this serialized form efficently.

set/2

set(Bloom::bloom(), Key::term()) -> ok

Record the presence of Key in Bloom.


Generated by EDoc