Current section

Files

Jump to
erbloom doc bloom_nif.html
Raw

doc/bloom_nif.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module bloom_nif</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module bloom_nif</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
This is a NIF wrapper around <a href="https://crates.io/crates/bloomfilter" target="_top"><tt>https://crates.io/crates/bloomfilter</tt></a>,
a simple but fast Bloom filter implementation, that requires only 2 hash functions,
generated with SipHash-1-3 using randomized keys.
<h2><a name="description">Description</a></h2>
This is a NIF wrapper around <a href="https://crates.io/crates/bloomfilter" target="_top"><tt>https://crates.io/crates/bloomfilter</tt></a>,
a simple but fast Bloom filter implementation, that requires only 2 hash functions,
generated with SipHash-1-3 using randomized keys.
<h2><a name="types">Data Types</a></h2>
<h3 class="typedecl"><a name="type-bloom">bloom()</a></h3>
<p><b>abstract datatype</b>: <tt>bloom()</tt></p>
<h3 class="typedecl"><a name="type-serialized_bloom">serialized_bloom()</a></h3>
<p><tt>serialized_bloom() = binary()</tt></p>
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#check-2">check/2</a></td><td>Check for the presence of <code>Key</code> in <code>Bloom</code>.</td></tr>
<tr><td valign="top"><a href="#check_and_set-2">check_and_set/2</a></td><td>Record the presence of <code>Key</code> in <code>Bloom</code> and return whether it was present before.</td></tr>
<tr><td valign="top"><a href="#clear-1">clear/1</a></td><td>Clear all of the bits in the filter, removing all keys from the set.</td></tr>
<tr><td valign="top"><a href="#deserialize-1">deserialize/1</a></td><td>Deserialize a previously serialized bloom filter back into a bloom filter reference.</td></tr>
<tr><td valign="top"><a href="#ftype-1">ftype/1</a></td><td>Get type of filter.</td></tr>
<tr><td valign="top"><a href="#new-1">new/1</a></td><td>Create a new filter structure.</td></tr>
<tr><td valign="top"><a href="#serialize-1">serialize/1</a></td><td>Serialize a bloom filter to Erlang terms.</td></tr>
<tr><td valign="top"><a href="#set-2">set/2</a></td><td>Record the presence of <code>Key</code> in <code>Bloom</code>.</td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="check-2">check/2</a></h3>
<div class="spec">
<p><tt>check(SerializedBloom::<a href="#type-bloom">bloom()</a> | <a href="#type-serialized_bloom">serialized_bloom()</a>, Key::term()) -&gt; boolean()</tt><br></p>
<p> </p>
</div><p>Check for the presence of <code>Key</code> in <code>Bloom</code>.
Serialized and binary encoded bloom filters can be used with this
function when you wish to check for the key and do not need to use set
(eg. a static bloom filter stored in a database).</p>
<h3 class="function"><a name="check_and_set-2">check_and_set/2</a></h3>
<div class="spec">
<p><tt>check_and_set(Bloom::<a href="#type-bloom">bloom()</a>, Key::term()) -&gt; boolean()</tt><br></p>
<p> </p>
</div><p>Record the presence of <code>Key</code> in <code>Bloom</code> and return whether it was present before.</p>
<h3 class="function"><a name="clear-1">clear/1</a></h3>
<div class="spec">
<p><tt>clear(Bloom::<a href="#type-bloom">bloom()</a>) -&gt; ok</tt><br></p>
<p> </p>
</div><p>Clear all of the bits in the filter, removing all keys from the set.</p>
<h3 class="function"><a name="deserialize-1">deserialize/1</a></h3>
<div class="spec">
<p><tt>deserialize(SerializedBloom::<a href="#type-serialized_bloom">serialized_bloom()</a>) -&gt; {ok, <a href="#type-bloom">bloom()</a>}</tt><br></p>
<p> </p>
</div><p>Deserialize a previously serialized bloom filter back into a bloom filter reference.</p>
<h3 class="function"><a name="ftype-1">ftype/1</a></h3>
<div class="spec">
<p><tt>ftype(_Ref::<a href="#type-bloom">bloom()</a>) -&gt; number() | {error, Reason::binary()}</tt><br></p>
<p> </p>
</div><p>Get type of filter</p>
<h3 class="function"><a name="new-1">new/1</a></h3>
<div class="spec">
<p><tt>new(_Opts::map) -&gt; {ok, Bloom::<a href="#type-bloom">bloom()</a>} | {error, Reason::binary()}</tt><br></p>
<p> </p>
</div><p>Create a new filter structure.</p>
<h3 class="function"><a name="serialize-1">serialize/1</a></h3>
<div class="spec">
<p><tt>serialize(Bloom::<a href="#type-bloom">bloom()</a>) -&gt; {ok, <a href="#type-serialized_bloom">serialized_bloom()</a>}</tt><br></p>
<p> </p>
</div><p>Serialize a bloom filter to Erlang terms. <code>check/2</code> can be used against this serialized form efficently.</p>
<h3 class="function"><a name="set-2">set/2</a></h3>
<div class="spec">
<p><tt>set(Bloom::<a href="#type-bloom">bloom()</a>, Key::term()) -&gt; ok</tt><br></p>
<p> </p>
</div><p>Record the presence of <code>Key</code> in <code>Bloom</code>.</p>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>