bloom

package module
v0.0.0-...-32222fc Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

Bloom

A bloom filter implementation using 32bit fnv and murmur3 hash functions.

Adding an item to the filter:

m := 32768
f := bloom.New(m)
f.Add([]byte("item"))

Checkng if an item might be in the filter:

if f.Check([]byte("item"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Bitset []byte
	// contains filtered or unexported fields
}

Filter is the representation of the bloom filter

func New

func New(m uint32) *Filter

New returns a new Filter

func (*Filter) Add

func (f *Filter) Add(item []byte)

Add adds a new item to the filter

func (*Filter) Check

func (f *Filter) Check(item []byte) bool

Check tests whether an item is in the filter

type MMapFilter

type MMapFilter struct {
	Bitset mmap.MMap
	// contains filtered or unexported fields
}

MMapFilter implements a bloom filter on a memory map

func NewMMap

func NewMMap(m uint32, filename string) *MMapFilter

NewMMap returns a new MMapFilter

func (*MMapFilter) Add

func (m *MMapFilter) Add(item []byte)

Add adds a new item to the mmap filter

func (*MMapFilter) Check

func (m *MMapFilter) Check(item []byte) bool

Check tests whether an item is in the mmap filter

Jump to

Keyboard shortcuts

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