An open API service indexing awesome lists of open source software.

https://github.com/jamesduncombe/petal

Petal is a Bloom filter in Elixir... 🌺
https://github.com/jamesduncombe/petal

bloom-filter elixir

Last synced: 9 months ago
JSON representation

Petal is a Bloom filter in Elixir... 🌺

Awesome Lists containing this project

README

          

# Petal 🌺

![tests](https://github.com/jamesduncombe/petal/workflows/tests/badge.svg)

Petal is a [Bloom filter](https://en.wikipedia.org/wiki/Bloom_filter) in Elixir.

## Usage

You can use Petal by adding it to your dependencies in `mix.exs`:

```elixir
def deps do
[
{:petal, "~> 0.2.1"}
]
end
```

Then within your config file you'll need to specify the hashing implementations to use:

```elixir
config :petal,
hashers: [
Petal.Hasher.Adler32,
Petal.Hasher.CRC32
]
```

The ones above are included with Petal. You are free to add your own though, just check [the
documentation](https://hexdocs.pm/petal/Petal.Hasher.html) for how to implement your own.

You can set the size of the filter with the config setting `filter_size`:

```elixir
config :petal,
filter_size: 64
```

To calculate what size filter you will need, you can use a handy calculator such as the one here: https://hur.st/bloomfilter.

By default this is set to 64 bits.

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc). The docs can also be found at [https://hexdocs.pm/petal](https://hexdocs.pm/petal).