bf

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 5 Imported by: 0

README

BF

BF is a bloom filter library for Go.

That's pretty much it.

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 a bloom filter.

func Basic

func Basic(size int) *BloomFilter

Basic returns a basic bloom filter with four has functions given a size. The size is rounded to the nearest 8.

func Custom

func Custom(size int, hashfns ...hash.Hash64) *BloomFilter

Custom returns a bloom filter given a size and hash functions. The size is rounded to the nearest 8.

func (*BloomFilter) Insert

func (bl *BloomFilter) Insert(data []byte)

Insert puts data into the bloom filter.

func (*BloomFilter) MarshalBinary

func (bl *BloomFilter) MarshalBinary() (data []byte, err error)

MarshalBinary returns the bloom filter's bitset in binary. It never returns an error.

func (*BloomFilter) Search

func (bl *BloomFilter) Search(data []byte) (pos bool)

Search queries the bloom filter with data.

func (*BloomFilter) String

func (bl *BloomFilter) String() string

String returns a string representation of the bloom filter's bitset as a series of ones and zeros.

func (*BloomFilter) UnmarshalBinary

func (bl *BloomFilter) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary reads from data in binary and writes to bloom filter's bitset. It never returns an error.

Jump to

Keyboard shortcuts

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