Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OptimalK ¶
OptimalK calculates the optimal number of hash functions to use for a Bloom filter based on the desired rate of false positives.
Types ¶
type Buckets ¶
type Buckets struct {
// contains filtered or unexported fields
}
Buckets is a fast, space-efficient array of buckets where each bucket can store up to a configured maximum value.
func NewBuckets ¶
NewBuckets creates a new Buckets with the provided number of buckets where each bucket is the specified number of bits.
func (*Buckets) Get ¶
Get returns the value in the specified bucket.
func (*Buckets) MaxBucketValue ¶
MaxBucketValue returns the maximum value that can be stored in a bucket.
func (*Buckets) Reset ¶
Reset restores the Buckets to the original state. Returns itself to allow for chaining.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter implements a classic thread-safe Bloom filter. A Bloom filter has a non-zero probability of false positives and a zero probability of false negatives.
func New ¶
New creates a new Bloom filter optimized to store n items with a specified target false-positive rate.
func (*Filter) Add ¶
Add will add the data to the Bloom filter. It returns the filter to allow for chaining.