filter

package
v0.0.0-...-678c32f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(bucket string, key []byte) error

Add will add key to filter bucket

func CheckThenAdd

func CheckThenAdd(bucket string, key []byte) (bool, error)

CheckThenAdd will check first and if the key is not in the filter bucket, then it will add it and return false, if the key is already in the bucket, it will just return true

func Exists

func Exists(bucket string, key []byte) bool

Exists checks if the key are already in filter bucket

func Register

func Register(name string, h Filter)

func Remove

func Remove(bucket string, key []byte) error

Remove will remove key from bucket

Types

type Filter

type Filter interface {
	Exists(bucket string, key []byte) bool
	Add(bucket string, key []byte) error
	Delete(bucket string, key []byte) error

	// CheckThenAdd will check if the key was exist in the bucket or not,
	// will return the previous status, and also add the key to the bucket if not exists
	CheckThenAdd(bucket string, key []byte) (bool, error)
	Open() error
	Close() error
}

Filter is used to check if the object is in the filter or not

Jump to

Keyboard shortcuts

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