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 (*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.