blf

package module
v0.0.0-...-3333cb2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 3 Imported by: 0

README

GitHub license Build Status

Bloom Filter

Simple Bloom Filter implement by golang Bloom Filter is the simple and space-efficient probabilistic data structure to check the data is exist or not. but Bloom Filter have the false positive rate. false positive rate mean the data is not in the set or storage but Bloom Filter return true. This implement is the Count Bloom Filter provide

  1. Add element to Bloom Filter
  2. Query element from Bloom Filter
  3. Remove element from Bloom Filter

Detail

Use the murmur3 hash as the Bloom Filter hash function

Install

go get github.com/Noahnut/blf

Usage

expectFalsePositiveRate := 0.5
// contruct the bloomFilter with expect element number and False Positive Rate
blf := ContructbloomFilter(100, expectFalsePositiveRate)

// Add the AAAA to the bloom filter
blf.Add([]byte("AAAA"))

// return true  "AAAA" exist in the bloom filter
blf.Query([]byte("AAAA")) 

// return false "BBB" not exist in the bloom filter
blf.Query([]byte("BBB"))

// remove "AAAA" from the bloom filter
blf.Delete([]byte("AAAA"))

// return false "AAAA" not exist in the bloom filter
blf.Query([]byte("AAAA"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContructbloomFilter

func ContructbloomFilter(itemSize uint64, falsePositiveRate float64) blf

Types

This section is empty.

Jump to

Keyboard shortcuts

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