Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SharedPrefix ¶
Returns the largest pos such that a[:pos] equals b[:pos].
Types ¶
type BloomFilter ¶
type BloomFilter []byte
A Bloom Filter is an encoded set of []byte keys.
func (BloomFilter) KeyMayMatch ¶
func (f BloomFilter) KeyMayMatch(key []byte) bool
func (BloomFilter) Name ¶
func (f BloomFilter) Name() string
type BytewiseComparator ¶
type BytewiseComparator struct{}
func (BytewiseComparator) Compare ¶
func (BytewiseComparator) Compare(a, b []byte) int
func (BytewiseComparator) Name ¶
func (BytewiseComparator) Name() string
type Comparator ¶
type Comparator interface { // Three-way comparison. Returns value: // < 0 iff "a" < "b", // == 0 iff "a" == "b", // > 0 iff "a" > "b" Compare(a, b []byte) int // Name returns the name of the comparator. // // The Level-DB on-disk format stores the comparator name, and opening a // database with a different comparator from the one it was created with // will result in an error. Name() string }
Provides a total order across slices that are used as keys in an sstable or a database. A Comparator implementation must be thread-safe since it may be invoked concurrently from multiple threads.
type QueryFilter ¶
type QueryFilter interface { // Name of the query filter Name() string // KeyMayMatch returns whether the filter may contain given key. False positives // are possible, where it returns true for keys not in the original set. KeyMayMatch(key []byte) bool }
func NewBloomFilter ¶
func NewBloomFilter(buf []byte, keys [][]byte, bitsPerKey int) QueryFilter
NewBloomFilter returns a new Bloom filter that encodes a set of []byte keys with the given number of bits per key. 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 value for bits per key is 10, which yields a filter with ~ 1% false positive rate.
Click to show internal directories.
Click to hide internal directories.