bloom

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bloom

type Bloom struct {
	ElemNum uint64
	// contains filtered or unexported fields
}

Bloom filter

func NewBloomFilter

func NewBloomFilter(entries, locs uint64) (bloomfilter *Bloom)

NewBloomFilter returns a new bloomfilter.

func NewBloomFilterWithErrorRate

func NewBloomFilterWithErrorRate(numEntries uint64, wrongs float64) *Bloom

NewBloomFilterWithErrorRate returns a new bloomfilter with optimal size for the given error rate

func (*Bloom) Add

func (bl *Bloom) Add(hash uint64)

Add adds hash of a key to the bloomfilter.

func (*Bloom) AddIfNotHas

func (bl *Bloom) AddIfNotHas(hash uint64) bool

AddIfNotHas only Adds hash, if it's not present in the bloomfilter. Returns true if hash was added. Returns false if hash was already registered in the bloomfilter.

func (*Bloom) Clear

func (bl *Bloom) Clear()

Clear resets the Bloom filter.

func (Bloom) Has

func (bl Bloom) Has(hash uint64) bool

Has checks if bit(s) for entry hash is/are set, returns true if the hash was added to the Bloom Filter.

func (*Bloom) IsSet

func (bl *Bloom) IsSet(idx uint64) bool

IsSet checks if bit[idx] of bitset is set, returns true/false.

func (*Bloom) Set

func (bl *Bloom) Set(idx uint64)

Set sets the bit[idx] of bitset.

func (*Bloom) Size

func (bl *Bloom) Size(sz uint64)

Size makes Bloom filter with as bitset of size sz.

func (*Bloom) TotalSize

func (bl *Bloom) TotalSize() int

TotalSize returns the total size of the bloom filter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL