Home

Awesome

erl-bloomd Build Status

erl-bloomd provides an Erlang client library to interface with bloomd servers. The library does not support any advanced features such as filter discovery and sharding. The library does support key hashing and automatically does pipelining of all requests.

Specifically, this is to support the bloomd network server, which provides a network protocol for manipulating bloom filters.

Features

Install

Add as a dependency in rebar, does not require any external libraries.

Example

Using erl-bloomd is very simple:

# Create a new connection
C = bloomd:new("east-bloomd-001", 8673).

# Get a list of filters, with their info
Filters = [{F, bloomd:filter_info(I)} || {F, I} <- bloomd:list(C)].

# Get a handle to the "test" filter, create it if necessary
F = bloomd:filter(C, "test").
bloomd:create(F).

# Set a property and check it exists
bloomd:set(F, "Test Key!").
true = bloomd:check(F, "Test Key!").

Using pipelining is transparent:

# Create a new connection
C = bloomd:new("east-bloomd-001", 8673).

# Get a handle to the "test" filter, create it if necessary
F = bloomd:filter(C, "test").
bloomd:create(F).

# Spawn and run in parallel
spawn(fun() -> bloomd:multi(F, ["a", "b", "c"]) end).
spawn(fun() -> bloomd:bulk(F, ["d", "e", "f"]) end).