filter

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(bys []byte) uint64

Hash compute hash @Description: @param bys @return uint64 todo: 测试这样分片是否均匀,已测试,很均匀

Types

type Filter

type Filter interface {

	// Add
	//  @Description: a key to filter
	//  @param key
	//  @return error
	Add(key []byte) error

	// ExistMult
	//  @Description: Check more keys is/not exist
	//  @param arr
	//  @return []bool
	ExistMult(arr [][]byte) []bool

	// Exist
	//  @Description: Check key is/not exist
	//  @param key
	//  @return bool
	//  @return error
	Exist(key []byte) (bool, error)

	// AddMult
	//  @Description: Add more key to filter
	//  @param arr
	//  @return error
	AddMult(arr [][]byte) error

	// SaveLastPoint
	//  @Description: Save last point to server
	//  @param pointK
	//  @param pointV
	//  @return error
	SaveLastPoint(pointK string, pointV string) error

	// GetLastPoint
	//  @Description: get last point to server
	//  @param pointK
	//  @return []string
	//  @return error
	GetLastPoint(pointK string) ([]string, error)
}

Filter support add key , check key is/not exist

func NewBigFilter

func NewBigFilter(n int, m uint, fpRate float64, redisServerCluster []string, pass *string,
	name string, logger protocol.Logger) (
	Filter, error)

NewBigFilter 创建一个 bigFilter @Description: args: n 子过滤器个数,m 每个子过滤器容量,fpRate 过滤器误判概率 @param n @param m @param fpRate @param redisServerCluster @param pass @param name @param logger @return Filter @return error

Jump to

Keyboard shortcuts

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