Documentation
¶
Overview ¶
Package bloom implements Bloom filters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter []byte
Filter is an encoded set of []byte keys.
func NewFilter ¶
NewFilter returns a new Bloom filter that encodes a set of []byte keys with the given number of bits per key, approximately. The returned Filter may be a sub-slice of buf[:cap(buf)] if it is large enough, otherwise the Filter will be allocated separately.
A good bitsPerKey value is 10, which yields a filter with ~ 1% false positive rate.
func (Filter) MayContain ¶
MayContain returns whether the filter may contain given key. False positives are possible, where it returns true for keys not in the original set.
type FilterPolicy ¶
type FilterPolicy int
FilterPolicy implements the db.FilterPolicy interface from the leveldb/db package.
The integer value is the approximate number of bits used per key. A good value is 10, which yields a filter with ~ 1% false positive rate.
It is valid to use the other API in this package (leveldb/bloom) without using this type or the leveldb/db package.
func (FilterPolicy) MayContain ¶
func (p FilterPolicy) MayContain(filter, key []byte) bool
MayContain implements the db.FilterPolicy interface.
func (FilterPolicy) Name ¶
func (p FilterPolicy) Name() string
Name implements the db.FilterPolicy interface.
func (FilterPolicy) NewFilter ¶
func (p FilterPolicy) NewFilter(keys [][]byte) []byte
NewFilter implements the db.FilterPolicy interface.