blob: ce1aef7930da4d5c34ef6ebeb94a8468dcb8712c [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BloomFilter (Apache HBase 3.0.0-alpha-2-SNAPSHOT API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BloomFilter (Apache HBase 3.0.0-alpha-2-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BloomFilter.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/hadoop/hbase/util/BloomContext.html" title="class in org.apache.hadoop.hbase.util"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html" title="interface in org.apache.hadoop.hbase.util"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/hadoop/hbase/util/BloomFilter.html" target="_top">Frames</a></li>
<li><a href="BloomFilter.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.hadoop.hbase.util</div>
<h2 title="Interface BloomFilter" class="title">Interface BloomFilter</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html" title="interface in org.apache.hadoop.hbase.util">BloomFilterBase</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.html" title="class in org.apache.hadoop.hbase.io.hfile">CompoundBloomFilter</a></dd>
</dl>
<hr>
<br>
<pre>@InterfaceAudience.Private
public interface <a href="../../../../../src-html/org/apache/hadoop/hbase/util/BloomFilter.html#line.77">BloomFilter</a>
extends <a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html" title="interface in org.apache.hadoop.hbase.util">BloomFilterBase</a></pre>
<div class="block">Implements a <i>Bloom filter</i>, as defined by Bloom in 1970.
<p>
The Bloom filter is a data structure that was introduced in 1970 and that has
been adopted by the networking research community in the past decade thanks
to the bandwidth efficiencies that it offers for the transmission of set
membership information between networked hosts. A sender encodes the
information into a bit vector, the Bloom filter, that is more compact than a
conventional representation. Computation and space costs for construction are
linear in the number of elements. The receiver uses the filter to test
whether various elements are members of the set. Though the filter will
occasionally return a false positive, it will never return a false negative.
When creating the filter, the sender can choose its desired point in a
trade-off between the false positive rate and the size.
<p>
Originally inspired by <a href="http://www.one-lab.org/">European Commission
One-Lab Project 034819</a>.
Bloom filters are very sensitive to the number of elements inserted into
them. For HBase, the number of entries depends on the size of the data stored
in the column. Currently the default region size is 256MB, so entry count ~=
256MB / (average value size for column). Despite this rule of thumb, there is
no efficient way to calculate the entry count after compactions. Therefore,
it is often easier to use a dynamic bloom filter that will add extra space
instead of allowing the error rate to grow.
( http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/BloomFilterSurvey
.pdf )
m denotes the number of bits in the Bloom filter (bitSize) n denotes the
number of elements inserted into the Bloom filter (maxKeys) k represents the
number of hash functions used (nbHash) e represents the desired false
positive rate for the bloom (err)
If we fix the error rate (e) and know the number of entries, then the optimal
bloom size m = -(n * ln(err) / (ln(2)^2) ~= n * ln(err) / ln(0.6185)
The probability of false positives is minimized when k = m/n ln(2).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilter.html" title="interface in org.apache.hadoop.hbase.util"><code>The general behavior of a filter</code></a>,
<a
href="http://portal.acm.org/citation.cfm?id=362692&dl=ACM&coll=portal">
Space/Time Trade-Offs in Hash Coding with Allowable Errors</a>,
<a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterWriter.html" title="interface in org.apache.hadoop.hbase.util"><code>for the ability to add elements to a Bloom filter</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilter.html#contains-byte:A-int-int-org.apache.hadoop.hbase.nio.ByteBuff-">contains</a></span>(byte[]&nbsp;buf,
int&nbsp;offset,
int&nbsp;length,
<a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;bloom)</code>
<div class="block">Check if the specified key is contained in the bloom filter.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilter.html#contains-org.apache.hadoop.hbase.Cell-org.apache.hadoop.hbase.nio.ByteBuff-org.apache.hadoop.hbase.regionserver.BloomType-">contains</a></span>(<a href="../../../../../org/apache/hadoop/hbase/Cell.html" title="interface in org.apache.hadoop.hbase">Cell</a>&nbsp;keyCell,
<a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;bloom,
<a href="../../../../../org/apache/hadoop/hbase/regionserver/BloomType.html" title="enum in org.apache.hadoop.hbase.regionserver">BloomType</a>&nbsp;type)</code>
<div class="block">Check if the specified key is contained in the bloom filter.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilter.html#supportsAutoLoading--">supportsAutoLoading</a></span>()</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.hadoop.hbase.util.BloomFilterBase">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.hadoop.hbase.util.<a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html" title="interface in org.apache.hadoop.hbase.util">BloomFilterBase</a></h3>
<code><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html#getByteSize--">getByteSize</a>, <a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html#getKeyCount--">getKeyCount</a>, <a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html#getMaxKeys--">getMaxKeys</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="contains-org.apache.hadoop.hbase.Cell-org.apache.hadoop.hbase.nio.ByteBuff-org.apache.hadoop.hbase.regionserver.BloomType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>contains</h4>
<pre>boolean&nbsp;<a href="../../../../../src-html/org/apache/hadoop/hbase/util/BloomFilter.html#line.87">contains</a>(<a href="../../../../../org/apache/hadoop/hbase/Cell.html" title="interface in org.apache.hadoop.hbase">Cell</a>&nbsp;keyCell,
<a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;bloom,
<a href="../../../../../org/apache/hadoop/hbase/regionserver/BloomType.html" title="enum in org.apache.hadoop.hbase.regionserver">BloomType</a>&nbsp;type)</pre>
<div class="block">Check if the specified key is contained in the bloom filter.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>keyCell</code> - the key to check for the existence of</dd>
<dd><code>bloom</code> - bloom filter data to search. This can be null if auto-loading
is supported.</dd>
<dd><code>type</code> - The type of Bloom ROW/ ROW_COL</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if matched by bloom, false if not</dd>
</dl>
</li>
</ul>
<a name="contains-byte:A-int-int-org.apache.hadoop.hbase.nio.ByteBuff-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>contains</h4>
<pre>boolean&nbsp;<a href="../../../../../src-html/org/apache/hadoop/hbase/util/BloomFilter.html#line.98">contains</a>(byte[]&nbsp;buf,
int&nbsp;offset,
int&nbsp;length,
<a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;bloom)</pre>
<div class="block">Check if the specified key is contained in the bloom filter.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - data to check for existence of</dd>
<dd><code>offset</code> - offset into the data</dd>
<dd><code>length</code> - length of the data</dd>
<dd><code>bloom</code> - bloom filter data to search. This can be null if auto-loading
is supported.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if matched by bloom, false if not</dd>
</dl>
</li>
</ul>
<a name="supportsAutoLoading--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>supportsAutoLoading</h4>
<pre>boolean&nbsp;<a href="../../../../../src-html/org/apache/hadoop/hbase/util/BloomFilter.html#line.104">supportsAutoLoading</a>()</pre>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if this Bloom filter can automatically load its data
and thus allows a null byte buffer to be passed to contains()</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/BloomFilter.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/hadoop/hbase/util/BloomContext.html" title="class in org.apache.hadoop.hbase.util"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/hadoop/hbase/util/BloomFilterBase.html" title="interface in org.apache.hadoop.hbase.util"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/hadoop/hbase/util/BloomFilter.html" target="_top">Frames</a></li>
<li><a href="BloomFilter.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2007&#x2013;2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>