Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketSize ¶
func BucketSize(s uint8) option
BucketSize sets the size of each bucket in the filter. Defaults to 4.
func FingerprintSize ¶
func FingerprintSize(s uint8) option
FingerprintSize sets the size of the fingerprint. Defaults to 2.
func HashFn ¶
HashFn sets the hashing function to be used for fingerprinting. Defaults to a 64-bit FNV-1 hash.Hash.
func MaximumKicks ¶
func MaximumKicks(k uint) option
MaximumKicks sets the maximum number of times we kick down items/displace from their buckets. Defaults to 500.
Types ¶
type CFilter ¶
type CFilter struct {
// contains filtered or unexported fields
}
func NewCuckooFilter ¶
func NewCuckooFilter(opts ...option) *CFilter
New returns a new CFilter object. It's Insert, Lookup, Delete and Size behave as their names suggest. Takes zero or more of the following option functions and applies them in order to the Filter:
- cuckoofilter.Size(uint) sets the number of buckets in the filter
- cuckoofilter.BucketSize(uint8) sets the size of each bucket
- cuckoofilter.FingerprintSize(uint8) sets the size of the fingerprint
- cuckoofilter.MaximumKicks(uint) sets the maximum number of bucket kicks
- cuckoofilter.HashFn(hash.Hash) sets the fingerprinting hashing function
func (*CFilter) Delete ¶
Delete removes an element (in byte-array form) from the Cuckoo Filter, returns true if element existed prior and false otherwise.
type CuckooFilter ¶
type CuckooFilter struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...option) *CuckooFilter
func (*CuckooFilter) Count ¶
func (f *CuckooFilter) Count() uint
func (*CuckooFilter) Delete ¶
func (f *CuckooFilter) Delete(item []byte) bool
func (*CuckooFilter) Insert ¶
func (f *CuckooFilter) Insert(item []byte) bool
func (*CuckooFilter) Lookup ¶
func (f *CuckooFilter) Lookup(item []byte) bool
func (*CuckooFilter) Update ¶
func (f *CuckooFilter) Update(filter *CFilter)