Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
/ bloomex Public archive

🌺 A pure Elixir implementation of Scalable Bloom Filters

License

Notifications You must be signed in to change notification settings

gmcabrita/bloomex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bloomex

Build Status Coverage Status Hex docs Hex Version License

Bloomex is a pure Elixir implementation of Scalable Bloom Filters.

Usage

Add Bloomex as a dependency in your mix.exs file.

def deps do
  [{:bloomex, "~> 1.0"}]
end

When you are done, run mix deps.get in your shell to fetch and compile Bloomex.

Examples

iex> bf = Bloomex.scalable(1000, 0.1, 0.1, 2)
%Bloomex.ScalableBloom...

iex> bf = Bloomex.add(bf, 5)
%Bloomex.ScalableBloom...

iex> Bloomex.member?(bf, 5)
true

iex> bf = Bloomex.add(bf, 100)
%Bloomex.ScalableBloom...

iex> Bloomex.member?(bf, 100)
true

iex> Bloomex.member?(bf, 105)
false

You can also pass in a hashing function to be used by the Bloom filter when creating one.

(assuming we have Murmur installed as a dependency)

iex> bf = Bloomex.scalable(1000, 0.1, 0.1, 2, &Murmur.hash_x86_128/1))
%Bloomex.ScalableBloom...

iex> bf = Bloomex.add(bf, 5)
%Bloomex.ScalableBloom...

iex> Bloomex.member?(bf, 5)
true

iex> bf = Bloomex.add(bf, 100)
%Bloomex.ScalableBloom...

iex> Bloomex.member?(bf, 100)
true