Safe and Fast Bloom Filter + FBFs for Erlang
- Bloom filter structure (type:
bloom
) - Forgetful Bloom Filters (type:
fbf
)
- linux
- macos
- windows
mix.exs:
{:erbloom, "~> 2.1.0-rc.2"}
rebar.config:
{erbloom, "2.1.0-rc.2"}
erlang.mk:
dep_erbloom = hex 2.1.0-rc.2
- Add deps in rebar.conf:
{deps, [
{erbloom, ".*", {git, "https://github.com/Vonmo/erbloom.git", {tag, "v2.0.2"}}}
]}
- Now you can create a new filter instance:
{ok, Filter} = bloom:new(9585059,1000000).
or filter with wanted rate of false positives:bloom:new_optimal(1000000, 0.55).
- Create a new forgetful filter:
{ok, Filter} = bloom:new_forgetful(BitmapSize, ItemsCount, NumFilters, RotateAfter).
or with fp_rate:bloom:new_forgetful_optimal(ItemsCount, NumFilters, RotateAfter, FpRate).
- Set a new element
bloom:set(Filter, "somekey").
- Check up element
bloom:check(Filter, "anotherkey").
- Serialize
{ok, Binary} = bloom:serialize(Filter).
- Deserialize
bloom:deserialize(Binary).
make build_imgs
- build docker imagesmake up
- run sandboxmake down
- terminate sandboxmake tests
- run testsmake lint
- lintermake xref
- xref analysismake prod
- generate release for targetmake doc
- generate documentation from EDoc
Without docker you must install erlang >=20.1 and rust >=1.23 on your machine. After you can run these goals:
release:
rebar3 as prod release
test:
rebar3 as test ct