bloomfilter

package module
v0.0.0-...-653a84c Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FILE_BF_BITEMAP = ".bitmap"
View Source
const FILE_BF_META = ".meta"

Variables

This section is empty.

Functions

This section is empty.

Types

type BF

type BF struct {
	BitSize  uint64
	HashSize int
	MaxSize  uint64
	Total    uint64
	// contains filtered or unexported fields
}

func LoadBF

func LoadBF(path string, name string) (*BF, error)

func NewBloomFilter

func NewBloomFilter(max uint32, fpp float64) *BF

func (*BF) Contains

func (b *BF) Contains(str string) bool

func (*BF) Dump

func (b *BF) Dump(path string, name string) error

func (*BF) Put

func (b *BF) Put(str string) bool

type Bitmap

type Bitmap struct {
	// contains filtered or unexported fields
}

func LoadBitMap

func LoadBitMap(read io.Reader, totalSize int64) (*Bitmap, error)

func NewBitmap

func NewBitmap(size uint64) *Bitmap

func (*Bitmap) Dump

func (b *Bitmap) Dump(w io.Writer) error

线程不安全的, 需要和Set,Get,Remove进行额外同步.

func (*Bitmap) Get

func (b *Bitmap) Get(index uint64) bool

return true:before value 1, false before value 0

func (*Bitmap) Remove

func (b *Bitmap) Remove(index uint64) bool

return true:before value 1, false before value 0

func (*Bitmap) Set

func (b *Bitmap) Set(index uint64) bool

return true:before value 1, false before value 0

Jump to

Keyboard shortcuts

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