Documentation ¶
Index ¶
Constants ¶
View Source
const ( // MaxFilterHashFuncs is the maximum number of hash functions of bloom filter. MaxFilterHashFuncs = 256 // MaxFilterSize is the maximum byte size in bytes a filter may be. MaxFilterSize = 1024 * 1024 // DefaultConflictRate is the default conflict rate for any key. DefaultConflictRate = 0.0001 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter interface { Matches(data []byte) bool Add(data []byte) MatchesAndAdd(data []byte) bool Merge(f Filter) error Reset() Copy(f Filter) error Size() uint32 K() uint32 Tweak() uint32 FPRate() float64 GetByte(i uint32) byte Indexes() []uint32 IsEmpty() bool conv.Serializable }
Filter defines bloom filter interface
func LoadFilter ¶
LoadFilter loads bloom filter from serialized data.
func NewFilterWithMK ¶
NewFilterWithMK returns a Filter. M is the cap of the bloom filter K is the number of hash functions
func NewFilterWithMKAndTweak ¶
NewFilterWithMKAndTweak returns a Filter with specific tweak for hash seed. M is the cap of the bloom filter K is the number of hash functions
Click to show internal directories.
Click to hide internal directories.