bloomfilter

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Redis_BloomMeta_Key      = "bloommeta"
	Redis_BloomMeta_Lock_Key = "bloommeta_lock"
)

Variables

This section is empty.

Functions

func EstimateParameters

func EstimateParameters(n uint, p float64) (uint, uint)

Types

type BitSetProvider

type BitSetProvider interface {
	// batch set or test exist
	Set(string, [][]uint) error
	Test(string, [][]uint) ([]bool, error)
	Clear()
	Online(bool)
}

type BloomFilter

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

func New

func New(m uint, k uint) *BloomFilter

func (*BloomFilter) Add

func (f *BloomFilter) Add(key string, data [][]byte) error

func (*BloomFilter) AddBitSetProvider

func (f *BloomFilter) AddBitSetProvider(name string, bitSet BitSetProvider)

func (*BloomFilter) BitSetClear

func (f *BloomFilter) BitSetClear(name string)

func (*BloomFilter) BitSetOnline

func (f *BloomFilter) BitSetOnline(name string, online bool)

func (*BloomFilter) Exists

func (f *BloomFilter) Exists(key string, data [][]byte) ([]bool, error)

func (*BloomFilter) SetHashFunc

func (f *BloomFilter) SetHashFunc(hf HashFunc)

type BloomFilterInterface

type BloomFilterInterface interface {
	Add(key string, data [][]byte) error
	Exists(key string, data [][]byte) ([]bool, error)
}

type BloomMeta

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

type BloomMetaStore

type BloomMetaStore interface {
	Get() (*BloomMeta, error)
	Save(*BloomMeta) error
	Lock() error
}

type BloomRotation

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

func (*BloomRotation) SetBloomMetaStore

func (f *BloomRotation) SetBloomMetaStore(store BloomMetaStore)

func (*BloomRotation) StartRotation

func (f *BloomRotation) StartRotation(activeProviderName string, rotationList []string, rotationInterval int64, overwirte bool)

type BloomRotationInterface

type BloomRotationInterface interface {
	BitSetClear(name string)
	BitSetOnline(name string, online bool)
}

type HashFunc

type HashFunc func(data [][]byte, m uint, k uint) [][]uint

data hash iterator with num

type RedisBitSet

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

func NewRedisBitSet

func NewRedisBitSet(redis *redis.Pool) *RedisBitSet

func (*RedisBitSet) Clear

func (r *RedisBitSet) Clear()

func (*RedisBitSet) Online

func (r *RedisBitSet) Online(online bool)

func (*RedisBitSet) Set

func (r *RedisBitSet) Set(key string, offsets [][]uint) error

func (*RedisBitSet) SetBatchCount

func (r *RedisBitSet) SetBatchCount(c int)

func (*RedisBitSet) SetResetFunc

func (r *RedisBitSet) SetResetFunc(f ResetFunc)

func (*RedisBitSet) Test

func (r *RedisBitSet) Test(key string, offsets [][]uint) ([]bool, error)

type RedisBloomFilter

type RedisBloomFilter struct {
	BloomRotation
	// contains filtered or unexported fields
}

func NewRedisBloom

func NewRedisBloom() *RedisBloomFilter

func (*RedisBloomFilter) Add

func (f *RedisBloomFilter) Add(key string, data [][]byte) error

func (*RedisBloomFilter) AddBitSetProvider

func (f *RedisBloomFilter) AddBitSetProvider(name string, bitSet redisBitSetProvider)

func (*RedisBloomFilter) BitSetClear

func (f *RedisBloomFilter) BitSetClear(name string)

func (*RedisBloomFilter) BitSetOnline

func (f *RedisBloomFilter) BitSetOnline(name string, online bool)

func (*RedisBloomFilter) Exists

func (f *RedisBloomFilter) Exists(key string, data [][]byte) ([]bool, error)

type ReidsBloomMetaStore

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

func NewReidsBloomMetaStore

func NewReidsBloomMetaStore(pool *redis.Pool) *ReidsBloomMetaStore

func (*ReidsBloomMetaStore) Get

func (r *ReidsBloomMetaStore) Get() (*BloomMeta, error)

func (*ReidsBloomMetaStore) Lock

func (r *ReidsBloomMetaStore) Lock() error

func (*ReidsBloomMetaStore) Save

func (r *ReidsBloomMetaStore) Save(meta *BloomMeta) error

type ResetFunc

type ResetFunc func(conn redis.Conn)

Jump to

Keyboard shortcuts

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