filter

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 5 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 contains the information for a BloomFilter data store.

func New

func New(size int, threshold float64) (*BloomFilter, error)

New creates a bloom filter

func (*BloomFilter) Add

func (bf *BloomFilter) Add(data []byte)

Add adds the data to the BloomFilter.

func (*BloomFilter) Export

func (bf *BloomFilter) Export() ([]byte, error)

Export the filter as JSON

func (*BloomFilter) Reset

func (bf *BloomFilter) Reset()

Reset clears the BloomFilter.

func (*BloomFilter) Test

func (bf *BloomFilter) Test(data []byte) bool

Test returns a bool if the data is in the BloomFilter. True indicates that the data may be in the BloomFilter, while false indicates that the data is not in the BloomFilter.

type ExportInterface

type ExportInterface struct {
	Size uint64  `json:"size"`
	Bits []uint8 `json:"bits"`
	Hash uint64  `json:"hash"`
}

ExportInterface contains the structure of the JSON export

Jump to

Keyboard shortcuts

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