README
¶
Bloom Filter
Bloom Filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970.
This implement is experimental to written Golang to prove the basic concept of Bloom Filter.
Install
go get github.com/kkdai/bloomfilter
Usage
//Create a couting bloom filter expect size 100, false detect rate 0.01
cbf := NewCountingBloomFilter(100, 0.01)
//Add item into cbf
cbf.Add([]byte("foo"))
cbf.Add([]byte("john"))
cbf.Add([]byte("tom"))
//test
fmt.Println("Test cbf:", cbf.Test([]byte("tom"))) //return "true"
//Remvoe item from cbf
cbf.Remove([]byte("john"))
//test again
fmt.Println("Test cbf:", cbf.Test([]byte("john"))) //return "false"
Inspired
Project52
It is one of my project 52.
License
This package is licensed under MIT license. See LICENSE for details.
Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBloomFilter ¶
CreateBloomFilter the basic function to create bloom filter.
Types ¶
type CBF ¶
type CBF struct {
// contains filtered or unexported fields
}
CBF :Counting Bloom Filter
Example ¶
Output:
func NewCountingBloomFilter ¶
NewCountingBloomFilter : Create a counting bloom filter with assigned expect element count and false detect rate.
Click to show internal directories.
Click to hide internal directories.