baseBloomfilter

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package baseBloomfilter implements a bloomfilter based on an m-bit bit array, k hashfilters and configuration.

It creates a bloomfilter based on bitset and an injected hasher, along with the following operations: add an element to the bloomfilter, check the existence of an element in the bloomfilter, the union of two bloomfilters, along with the serialization and deserialization of a bloomfilter: http://llimllib.github.io/bloomfilter-tutorial/

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 basic type

func New

func New(cfg bloomfilter.Config) *Bloomfilter

New creates a new bloomfilter from a given config

func (Bloomfilter) Add

func (b Bloomfilter) Add(elem []byte)

Add an element to bloomfilter

func (*Bloomfilter) Capacity

func (b *Bloomfilter) Capacity() float64

Capacity returns the fill degree of the bloomfilter

func (Bloomfilter) Check

func (b Bloomfilter) Check(elem []byte) bool

Check if an element is in the bloomfilter

func (*Bloomfilter) MarshalBinary

func (b *Bloomfilter) MarshalBinary() ([]byte, error)

MarshalBinary serializes a bloomfilter

func (*Bloomfilter) Union

func (b *Bloomfilter) Union(that interface{}) (float64, error)

Union of two bloomfilters

func (*Bloomfilter) UnmarshalBinary

func (b *Bloomfilter) UnmarshalBinary(data []byte) error

UnmarshalBinary deserializes a bloomfilter

type SerializibleBloomfilter

type SerializibleBloomfilter struct {
	BS       bitset.Bitset
	M        uint
	K        uint
	HashName string
	Cfg      bloomfilter.Config
}

SerializibleBloomfilter used when (de)serializing a bloomfilter

Jump to

Keyboard shortcuts

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