Copyright © (C) 2019, Matthew Pope
Authors: Matthew Pope.
Interface for the xor8 filter.
Shorthand for the exor_filter
module. For indepth documentation, see
that module.
Filter = xor8:new(["cat", "dog", "mouse"]), true = xor8:contain(Filter, "cat"), false = xor8:contain(Filter, "goose"), ok = xor8:free(Filter).
contain/2 | Tests to see if the passed argument is in the filter. |
contain/3 | Tests to see if the passed argument is in the filter. |
from_bin/1 | Deserializes a filter from a binary previously serialized with to_bin/1
that used the default hash function. |
from_bin/2 | Deserializes a filter from a binary previously serialized with to_bin/1
that used a custom hash function. |
new/1 | Initializes the xor filter, and runs the default hash function on each of the elements in the list. |
new/2 | Initializes the xor filter, and runs the specified hash on each of the elements in the list. |
new_buffered/1 | Initializes the xor filter, and runs the default hash function on each of the elements in the list. |
new_buffered/2 | Initializes the xor filter, and runs the default hash function on each of the elements in the list. |
to_bin/1 | Serializes the filter to a binary that can be later be deserialized with
from_bin/1 or from_bin/2 |
contain(Filter::{reference(), atom() | function()}, Key::term()) -> true | false
Tests to see if the passed argument is in the filter. The first argument must be the pre-initialized filter.
contain(Filter::{reference(), atom() | function()}, Key::term(), ReturnValue::any()) -> true | any()
Tests to see if the passed argument is in the filter. The first argument must be the pre-initialized filter.
Will return the third argument if the element doesn't exist in the filter.from_bin(Filter::binary()) -> {reference(), atom()}
Deserializes a filter from a binary previously serialized with to_bin/1
that used the default hash function.
from_bin(Filter::binary(), Hash::atom() | function()) -> {reference(), atom() | function()}
Deserializes a filter from a binary previously serialized with to_bin/1
that used a custom hash function.
new(List::list()) -> {reference(), atom()} | {error, atom()}
Initializes the xor filter, and runs the default hash function on each of the elements in the list. This should be fine for the general case.
new(List::list(), HashFunction::atom() | function()) -> {reference(), atom() | function()} | {error, atom()}
Initializes the xor filter, and runs the specified hash on each of the elements in the list.
The optiondefault_hash
uses the erlang:phash2/1
function.
The option none
is for prehashed data.
A fun can be passed that will be applied to each element.
new_buffered(List::list()) -> {reference(), atom()} | {error, atom()}
Initializes the xor filter, and runs the default hash function on each of the elements in the list. This is the buffered version, meant for large filters.
new_buffered(List::list(), HashFunction::atom() | function()) -> {reference(), atom() | function()} | {error, atom()}
Initializes the xor filter, and runs the default hash function on
each of the elements in the list. This is the buffered version, meant for
large filters. See the xor8:new/2
or exor_filter:xor8_new/2
funtions
for more indepth documentaiton.
to_bin(Filter::reference()) -> binary()
Serializes the filter to a binary that can be later be deserialized with
from_bin/1
or from_bin/2
binary()
.
Generated by EDoc