bloomfilter

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 5 Imported by: 0

README

go-bloomfilter

bloomfilter for golang

Example

bf := bloomfilter.NewMemoryBloomFilter(100000, 0.001, nil)
bf.Add([]byte("hello"))
bf.Add([]byte("world"))
fmt.Printf("Capacity: %d\n", bf.Capacity())
fmt.Printf("Size: %d\n", bf.Size())
fmt.Printf("Error: %f\n", bf.Error())
fmt.Printf("Exists[hello]: %v\n", bf.Contains([]byte("hello")))
fmt.Printf("Exists[world]: %v\n", bf.Contains([]byte("world")))
fmt.Printf("Exists[golang]: %v\n", bf.Contains([]byte("golang")))

Run Test

go test

License

MIT License Copyright (c) 2023 coderjun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBloomFilter

func NewBloomFilter(capacity int64, errorRate float64, container container.BloomFilterContainer, hashFunc HashFunction) *baseBloomFilter

func NewMemoryBloomFilter

func NewMemoryBloomFilter(capacity int64, errorRate float64, hashFunc HashFunction) *baseBloomFilter

Types

type HashFunction

type HashFunction func(hashId int32, value []byte) int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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