org.apache.hadoop.hbase.util
Interface BloomFilter

All Superinterfaces:
BloomFilterBase
All Known Implementing Classes:
ByteBloomFilter, CompoundBloomFilter

@InterfaceAudience.Private
public interface BloomFilter
extends BloomFilterBase

Defines the general behavior of a bloom filter.

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.

See Also:
for the ability to add elements to a Bloom filter

Method Summary
 boolean contains(byte[] buf, int offset, int length, ByteBuffer bloom)
          Check if the specified key is contained in the bloom filter.
 boolean supportsAutoLoading()
           
 
Methods inherited from interface org.apache.hadoop.hbase.util.BloomFilterBase
createBloomKey, getByteSize, getComparator, getKeyCount, getMaxKeys
 

Method Detail

contains

boolean contains(byte[] buf,
                 int offset,
                 int length,
                 ByteBuffer bloom)
Check if the specified key is contained in the bloom filter.

Parameters:
buf - data to check for existence of
offset - offset into the data
length - length of the data
bloom - bloom filter data to search. This can be null if auto-loading is supported.
Returns:
true if matched by bloom, false if not

supportsAutoLoading

boolean supportsAutoLoading()
Returns:
true if this Bloom filter can automatically load its data and thus allows a null byte buffer to be passed to contains()


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.