go_bloom_filter

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-bloom-filter

Build Go Report Card GoDoc

BloomFilter written in Golang.

Implementations

This repository contains several bloomfilter implementations that you can use to solve different distributed computing problems. The solution starts from an optimized local implementation that adds rotation, RPC coordination, and generic rejecters. The packages are:

  • bitset: Implementations of bitsets for basic sets.
  • bloomfilter: Optimized implementation of the bloomfilter.
  • rotable: Implementation over the BF with 3 rotating buckets.
  • rpc: Implementation of an RPC layer over rotable.
  • sonic:Integration of the rpc package as a rejecter for Sonic

Documentation

Overview

Package go_bloom_filter contains common data and interfaces needed to implement BloomFilters

Index

Constants

View Source
const (
	HASHER_DEFAULT = "default"
	HASHER_OPTIMAL = "optimal"
)

Variables

View Source
var (
	HashFactoryNames = map[string]HashFactory{
		HASHER_DEFAULT: DefaultHashFactory,
		HASHER_OPTIMAL: OptimalHashFactory,
	}

	ErrImpossibleToTreat = fmt.Errorf("unable to union")

	MD5    = HashWrapper(md5.New())
	SHA1   = HashWrapper(sha1.New())
	CRC64  = HashWrapper(crc64.New(crc64.MakeTable(crc64.ECMA)))
	FNV64  = HashWrapper(fnv.New64())
	FNV128 = HashWrapper(fnv.New128())
)
View Source
var EmptyConfig = Config{
	N: 2,
	P: .5,
}

Functions

func K

func K(m, n uint) uint

func M

func M(n uint, p float64) uint

Types

type BloomFilter

type BloomFilter interface {
	Add([]byte)
	Check([]byte) bool
	Union(interface{}) (float64, error)
}

type Config

type Config struct {
	N        uint
	P        float64
	HashName string
}

type EmptySet

type EmptySet int

func (EmptySet) Add

func (e EmptySet) Add(_ []byte)

func (EmptySet) Check

func (e EmptySet) Check(_ []byte) bool

func (EmptySet) Union

func (e EmptySet) Union(interface{}) (float64, error)

type Hash

type Hash func([]byte) []uint

func DefaultHashFactory

func DefaultHashFactory(k uint) []Hash

func HashWrapper

func HashWrapper(h hash.Hash) Hash

func OptimalHashFactory

func OptimalHashFactory(k uint) []Hash

type HashFactory

type HashFactory func(uint) []Hash

Directories

Path Synopsis
Package bitset implements a bitset based on the bitset library
Package bitset implements a bitset based on the bitset library
cmd
client
Client application that reads from keyboard add and checks operations with data to store to a BloomFilter by means of a rpc
Client application that reads from keyboard add and checks operations with data to store to a BloomFilter by means of a rpc
server
Server application that registers a bloomfilter by means of a rpc
Server application that registers a bloomfilter by means of a rpc
Package filter implements a BloomFilter based on an m-bit bit array, k hashfilters and configuration
Package filter implements a BloomFilter based on an m-bit bit array, k hashfilters and configuration
Package rotate implements a sliding set of three BloomFilters: `previous`, `current` and `next` and the BloomFilter interface
Package rotate implements a sliding set of three BloomFilters: `previous`, `current` and `next` and the BloomFilter interface
rpc
client
Package client implements a rpc client for the BloomFilter, along with Add and Check methods
Package client implements a rpc client for the BloomFilter, along with Add and Check methods
server
Package server implements a rpc server for the BloomFilter, registering a BloomFilter and accepting a tcp listener
Package server implements a rpc server for the BloomFilter, registering a BloomFilter and accepting a tcp listener
Package sonic registers a bloomfilter given a config and registers the service with consul
Package sonic registers a bloomfilter given a config and registers the service with consul
Package testutil contains utils for the tests
Package testutil contains utils for the tests

Jump to

Keyboard shortcuts

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