Search documentation of jhn_stdlib

# jhn_bloom (jhn_stdlib v5.10.3)

View Source

Implements Bloom filters Based on: Scalable Bloom Filters by Paulo Sérgio Almeida, Carlos Baquero, Nuno Preguiça, David Hutchison

# Summary

## Types

filter/0
opt/0

## Functions

add(Term, F)

Adds a term to the Bloom filter

capacity(Filter)

Returns the capacity of the Bloom filter

filter()

Returns a bloom filter

filter(Opts)

Returns a bloom filter Options are: fixed -> standard partitioned bloom filter, default type scalable -> scalable bloom filter size -> the maximum size for fixed and initial size for scalable filter the defaults are 4000 and 32000 respectively error_prob -> error probability, default 0.001 Options relevant to scalable filters only growth_ratio -> log 2 of growth ratio, one of 1, 2, 3 default 1 error_ratio -> error probability ratio, default 0.85

is_filter(Filter)

Returns true if the argument is a Bloom filter

member(Term, Filter)

Returns if the term is a member of the Bloom filter

type(Filter)

Returns the type of Bloom filter

# Types

# filter/0

    -opaque filter()

# opt/0

    -type opt() ::
              fixed | scalable |
              {size, integer()} |
              {error_prob, float()} |
              {error_ratio, float()} |
              {growth_ratio, integer()}.

# Functions

# add(Term, F)

    -spec add(_, filter()) -> filter().

Adds a term to the Bloom filter

# capacity(Filter)

    -spec capacity(filter()) -> integer().

Returns the capacity of the Bloom filter

# filter()

    -spec filter() -> filter().

Returns a bloom filter

# filter(Opts)

    -spec filter([opt()] | filter()) -> filter().

Returns a bloom filter Options are: fixed -> standard partitioned bloom filter, default type scalable -> scalable bloom filter size -> the maximum size for fixed and initial size for scalable filter the defaults are 4000 and 32000 respectively error_prob -> error probability, default 0.001 Options relevant to scalable filters only growth_ratio -> log 2 of growth ratio, one of 1, 2, 3 default 1 error_ratio -> error probability ratio, default 0.85

# is_filter(Filter)

    -spec is_filter(_) -> boolean().

Returns true if the argument is a Bloom filter

# member(Term, Filter)

    -spec member(_, filter()) -> boolean().

Returns if the term is a member of the Bloom filter

# type(Filter)

    -spec type(_) -> fixed | scalable.

Returns the type of Bloom filter