Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gmcabrita/bloomex
:hibiscus: A pure Elixir implementation of Scalable Bloom Filters
https://github.com/gmcabrita/bloomex
bloom-filter data-structures elixir hex probabilistic-data-structures scalable-bloom-filters
Last synced: 3 days ago
JSON representation
:hibiscus: A pure Elixir implementation of Scalable Bloom Filters
- Host: GitHub
- URL: https://github.com/gmcabrita/bloomex
- Owner: gmcabrita
- License: mit
- Archived: true
- Created: 2014-10-19T23:43:40.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2021-06-08T19:02:15.000Z (over 3 years ago)
- Last Synced: 2024-10-08T18:29:16.014Z (26 days ago)
- Topics: bloom-filter, data-structures, elixir, hex, probabilistic-data-structures, scalable-bloom-filters
- Language: Elixir
- Homepage:
- Size: 87.9 KB
- Stars: 113
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A pure Elixir implementation of Scalable Bloom Filters. (Algorithms and Data structures)
- fucking-awesome-elixir - bloomex - A pure Elixir implementation of Scalable Bloom Filters. (Algorithms and Data structures)
- awesome-elixir - bloomex - A pure Elixir implementation of Scalable Bloom Filters. (Algorithms and Data structures)
README
Bloomex
=======[![Build Status](https://img.shields.io/github/workflow/status/gmcabrita/bloomex/CI/master.svg)](https://github.com/gmcabrita/bloomex/actions)
[![Coverage Status](https://img.shields.io/coveralls/gmcabrita/bloomex.svg?style=flat)](https://coveralls.io/r/gmcabrita/bloomex?branch=master)
[![Hex docs](http://img.shields.io/badge/hex.pm-docs-green.svg?style=flat)](https://hexdocs.pm/bloomex)
[![Hex Version](http://img.shields.io/hexpm/v/bloomex.svg?style=flat)](https://hex.pm/packages/bloomex)
[![License](http://img.shields.io/hexpm/l/bloomex.svg?style=flat)](https://github.com/gmcabrita/bloomex/blob/master/LICENSE)Bloomex is a pure Elixir implementation of [Scalable Bloom Filters](http://haslab.uminho.pt/cbm/files/dbloom.pdf).
# Usage
Add Bloomex as a dependency in your mix.exs file.
```elixir
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
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)
trueiex> bf = Bloomex.add(bf, 100)
%Bloomex.ScalableBloom...iex> Bloomex.member?(bf, 100)
trueiex> 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](https://hex.pm/packages/murmur/) installed as a dependency)
```iex
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)
trueiex> bf = Bloomex.add(bf, 100)
%Bloomex.ScalableBloom...iex> Bloomex.member?(bf, 100)
true
``````