bitmap

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

README

bitmap

Supporting bitmap

Documentation

Overview

Package bitmap provides ways for filter to manipulate bit set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

type Bitmap interface {
	// CheckBits returns true if all bits on locs have set.
	CheckBits(locs []uint64) (bool, error)
	// SetBits sets all bits on locs.
	SetBits(locs []uint64) error
}

type InMemory added in v0.2.0

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

func NewInMemory added in v0.2.0

func NewInMemory(m uint64) *InMemory

NewInMemory returns in-memory bitmap which is backed by github.com/bits-and-blooms/bitset.

func (*InMemory) CheckBits added in v0.2.0

func (im *InMemory) CheckBits(locs []uint64) (bool, error)

func (*InMemory) SetBits added in v0.2.0

func (im *InMemory) SetBits(locs []uint64) error

type Redis

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

func NewRedis

func NewRedis(ctx context.Context, client *redis.Client, key string, m uint64, opts ...RedisOption) (*Redis, error)

NewRedis returns bitmap that is store into redis and manipulated via github.com/go-redis/redis.

func (*Redis) CheckBits

func (r *Redis) CheckBits(locs []uint64) (bool, error)

func (*Redis) SetBits

func (r *Redis) SetBits(locs []uint64) error

type RedisOption added in v0.2.0

type RedisOption func(*Redis) error

func RedisSetExpireTTL added in v0.2.0

func RedisSetExpireTTL(d time.Duration) RedisOption

RedisSetExpireTTL sets expiry TTL with d.

Jump to

Keyboard shortcuts

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