filter

package
v0.0.0-...-19f20a4 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Exists = struct{}{}

Functions

func DefaultHash

func DefaultHash(cap uint, seed uint, value string) uint

hash 方法

Types

type BloomFilter

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

func NewBloomFilter

func NewBloomFilter(size uint, seeds []uint, set BloomSet, hashFunc func(uint, uint, string) uint) *BloomFilter

func (*BloomFilter) Add

func (bf *BloomFilter) Add(value string)

func (*BloomFilter) Contains

func (bf *BloomFilter) Contains(value string) bool

type BloomSet

type BloomSet interface {
	Set(v interface{})
	SetAll(values []interface{})
	Contain(v interface{}) bool
	ContainAll(values []interface{}) bool
}

type CuckooFilter

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

func Decode

func Decode(bytes []byte) (*CuckooFilter, error)

func NewFilter

func NewFilter(capacity uint) *CuckooFilter

func (*CuckooFilter) Count

func (cf *CuckooFilter) Count() uint

func (*CuckooFilter) Delete

func (cf *CuckooFilter) Delete(data []byte) bool

Delete data from counter if exists and return if deleted or not

func (*CuckooFilter) Encode

func (cf *CuckooFilter) Encode() []byte

func (*CuckooFilter) Insert

func (cf *CuckooFilter) Insert(data []byte) bool

Insert inserts data into the counter and returns true upon success

func (*CuckooFilter) InsertUnique

func (cf *CuckooFilter) InsertUnique(data []byte) bool

InsertUnique inserts data into the counter if not exists and returns true upon success

func (*CuckooFilter) Lookup

func (cf *CuckooFilter) Lookup(data []byte) bool

Lookup returns true if data is in the counter

func (*CuckooFilter) Reset

func (cf *CuckooFilter) Reset()

Reset ...

type RedisSet

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

func NewRedisSet

func NewRedisSet(length uint) *RedisSet

func (*RedisSet) Contain

func (r *RedisSet) Contain(i interface{}) bool

func (*RedisSet) ContainAll

func (r *RedisSet) ContainAll(values []interface{}) bool

func (*RedisSet) Set

func (r *RedisSet) Set(i interface{})

func (*RedisSet) SetAll

func (r *RedisSet) SetAll(values []interface{})

type Set

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

func NewSet

func NewSet(items ...interface{}) *Set

func (*Set) Add

func (s *Set) Add(items ...interface{}) error

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Contains

func (s *Set) Contains(item interface{}) bool

func (*Set) Size

func (s *Set) Size() int

func (*Set) ToSlice

func (s *Set) ToSlice() []interface{}

Jump to

Keyboard shortcuts

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