bloom

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 3 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHashMismatch = errors.New("failed to verify hash")
	ErrNumHash      = errors.New("invalid number of hash functions, expect 0 < k < 256")
)

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter interface {
	// Size of bloom filter in bits
	Size() uint64

	// NumHash is the number of hash functions used
	NumHash() uint64

	// NumElements is the number of elements in the bloom filter
	NumElements() uint64

	// Add key into bloom filter
	Add([]byte)

	// Exist checks if a key is in bloom filter
	Exist([]byte) bool

	// Bytes returns the bytes of bloom filter
	Bytes() []byte

	// FromBytes loads data into the struct
	FromBytes([]byte) error
}

BloomFilter interface

func NewBloomFilter

func NewBloomFilter(m, h uint64) (BloomFilter, error)

NewBloomFilter returns a new bloom filter

func NewBloomFilterLegacy added in v0.1.5

func NewBloomFilterLegacy(m, h uint) (BloomFilter, error)

NewBloomFilterLegacy returns a legacy new bloom filter it does not support NumElements()

Jump to

Keyboard shortcuts

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