bloom

package module
v0.0.0-...-5d171dd Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter struct {
	// contains filtered or unexported fields
}

BloomFilter is the main struct that represents the classic bloom filter.

func LoadFromFile

func LoadFromFile(filename string) (*BloomFilter, error)

LoadFromFile loads the bloom filter from a file. It loads the bloom filter metadata (bits, hash number, insertions) and byte array from the file.

func New

func New(n int, fpr float64) *BloomFilter

New creates a new bloom filter.

func (*BloomFilter) Add

func (b *BloomFilter) Add(elem string) error

Add adds an element to the bloom filter.

func (*BloomFilter) Contains

func (b *BloomFilter) Contains(elem string) bool

Contains checks if an element is in the bloom filter.

func (*BloomFilter) InsertionsCount

func (b *BloomFilter) InsertionsCount() int

InsertionsCount returns the number of elements inserted in the bloom filter.

func (*BloomFilter) MemoryUsage

func (b *BloomFilter) MemoryUsage() int

MemoryUsage returns the memory usage of the bloom filter. It returns the number of bytes used by the bloom filter.

func (*BloomFilter) SaveToFile

func (b *BloomFilter) SaveToFile(filename string) error

SaveToFile saves the bloom filter to a file. It save the bloom filter metadata (bits, hash number, insertions) and byte array to the file.

Jump to

Keyboard shortcuts

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