Documentation
¶
Overview ¶
Package bloomfilter provides ...
Index ¶
- type BF
- type Hasher
- type MemoryStore
- type Redis
- type Store
- type VBF
- type VBF2
- type VBF3
- type VBF3Gen
- type VBF3Redis
- func (rf *VBF3Redis) AdvanceGeneration(ctx context.Context, generations uint8) error
- func (rf *VBF3Redis) Check(ctx context.Context, d []byte) (bool, error)
- func (rf *VBF3Redis) Delete(ctx context.Context) error
- func (rf *VBF3Redis) Prepare(ctx context.Context, maxLife uint8) error
- func (rf *VBF3Redis) Put(ctx context.Context, d []byte, life uint8) error
- func (rf *VBF3Redis) Sweep(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BF ¶
type BF struct {
// contains filtered or unexported fields
}
BF provides standard bloom filter algorithm.
func (*BF) CheckString ¶
CheckString checks that a byte array is in the filter.
type MemoryStore ¶
type MemoryStore []byte
MemoryStore provides Store interface with memory.
func NewMemoryStore ¶
func NewMemoryStore(nbits int) MemoryStore
NewMemoryStore creates a memory store for bloom filter.
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis provides volatile bloom filter which use redis as store.
func NewRedis ¶
func NewRedis(uc redis.UniversalClient, name string, m, k int) *Redis
NewRedis creates a new Redis bloom filter.
type Store ¶
type Store interface {
// SetBits sets bits on indexes in the store.
SetBits(ctx context.Context, indexes ...int) error
// CheckBits checks all bits are `true` on indexes in the store.
CheckBits(ctx context.Context, indexes ...int) (bool, error)
}
Store defines bits store for bloom filter (BF).
type VBF2 ¶
type VBF2 struct {
// contains filtered or unexported fields
}
VBF2 is fix TTL volatile bloom filter. It suppose to replace its backend with Redis.
type VBF3 ¶
type VBF3 struct {
// contains filtered or unexported fields
}
VBF2 is moving windowed volatile bloom filter.
func (*VBF3) AdvanceGeneration ¶
AdvanceGeneration advances generation. If the generation exhausted, data will be expired/evaporated.
type VBF3Redis ¶
type VBF3Redis struct {
// contains filtered or unexported fields
}
VBF3Redis provides VBF3 with Redis backend.
func NewVBF3Redis ¶
func NewVBF3Redis(uc redis.UniversalClient, name string, m, k int) *VBF3Redis