package bloom
import "github.com/influxdata/influxdb/pkg/bloom"
Index ¶
- func Estimate(n uint64, p float64) (m uint64, k uint64)
- type Filter
- func NewFilter(m uint64, k uint64) *Filter
- func NewFilterBuffer(buf []byte, k uint64) (*Filter, error)
- func (f *Filter) Bytes() []byte
- func (f *Filter) Clone() *Filter
- func (f *Filter) Contains(v []byte) bool
- func (f *Filter) Insert(v []byte)
- func (f *Filter) K() uint64
- func (f *Filter) Len() uint
- func (f *Filter) Merge(other *Filter) error
Functions ¶
func Estimate ¶
Estimate returns an estimated bit count and hash count given the element count and false positive rate.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter represents a bloom filter.
func NewFilter ¶
NewFilter returns a new instance of Filter using m bits and k hash functions. If m is not a power of two then it is rounded to the next highest power of 2.
func NewFilterBuffer ¶
NewFilterBuffer returns a new instance of a filter using a backing buffer. The buffer length MUST be a power of 2.
func (*Filter) Bytes ¶
Bytes returns the underlying backing slice.
func (*Filter) Clone ¶
Clone returns a copy of f.
func (*Filter) Contains ¶
Contains returns true if the filter possibly contains v. Returns false if the filter definitely does not contain v.
func (*Filter) Insert ¶
Insert inserts data to the filter.
func (*Filter) K ¶
K returns the number of hash functions used in the filter.
func (*Filter) Len ¶
Len returns the number of bits used in the filter.
func (*Filter) Merge ¶
Merge performs an in-place union of other into f. Returns an error if m or k of the filters differs.
Source Files ¶
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 2 days ago –
Tools for package owners.