bitmap

package
v0.0.0-...-baaee6e Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicOps

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

BasicOps handles basic bitmap operations

func NewBasicOps

func NewBasicOps(cache *sync.Map, version *sync.Map) *BasicOps

NewBasicOps creates a new BasicOps instance

func (*BasicOps) CreateBitmap

func (b *BasicOps) CreateBitmap(key string, size int) error

CreateBitmap creates a new bitmap of given size

func (*BasicOps) GetBit

func (b *BasicOps) GetBit(key string, offset int64) (int, error)

GetBit returns the bit value at offset

func (*BasicOps) GetBitmap

func (b *BasicOps) GetBitmap(key string) []byte

GetBitmap returns the underlying byte slice for a key

func (*BasicOps) SetBit

func (b *BasicOps) SetBit(key string, offset int64, value int) (int, error)

SetBit sets the bit at offset to value and returns the old value

type BitwiseOps

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

func NewBitwiseOps

func NewBitwiseOps(basicOps *BasicOps) *BitwiseOps

func (*BitwiseOps) BitOp

func (b *BitwiseOps) BitOp(operation string, destkey string, keys ...string) (int64, error)

BitOp performs a bitwise operation on multiple bitmaps

type CountOps

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

func NewCountOps

func NewCountOps(basicOps *BasicOps) *CountOps

func (*CountOps) BitCount

func (c *CountOps) BitCount(key string, start, end int64) (int64, error)

BitCount returns the number of set bits (1) in the bitmap

func (*CountOps) BitPos

func (c *CountOps) BitPos(key string, bit int, start, end int64, reverse bool) (int64, error)

BitPos finds the position of the first bit set to a given value (0 or 1)

func (*CountOps) CountBitsInRange

func (c *CountOps) CountBitsInRange(b byte, start, end int) int

CountBitsInRange counts bits in a specific range within a byte

type FieldOps

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

func NewFieldOps

func NewFieldOps(basicOps *BasicOps) *FieldOps

func (*FieldOps) BitField

func (f *FieldOps) BitField(key string, commands []models.BitFieldCommand) ([]int64, error)

BitField executes multiple bitfield commands on a bitmap

func (*FieldOps) BitFieldRO

func (f *FieldOps) BitFieldRO(key string, commands []models.BitFieldCommand) ([]int64, error)

BitFieldRO executes read-only bitfield operations

type Manager

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

func NewManager

func NewManager(bcache *sync.Map, version *sync.Map) *Manager

func (*Manager) BitCount

func (m *Manager) BitCount(key string, start, end int64) (int64, error)

func (*Manager) BitField

func (m *Manager) BitField(key string, commands []models.BitFieldCommand) ([]int64, error)

func (*Manager) BitFieldRO

func (m *Manager) BitFieldRO(key string, commands []models.BitFieldCommand) ([]int64, error)

func (*Manager) BitOp

func (m *Manager) BitOp(operation string, destkey string, keys ...string) (int64, error)

func (*Manager) BitPos

func (m *Manager) BitPos(key string, bit int, start, end int64, reverse bool) (int64, error)

func (*Manager) GetBit

func (m *Manager) GetBit(key string, offset int64) (int, error)

func (*Manager) GetBitmap

func (m *Manager) GetBitmap(key string) []byte

func (*Manager) SetBit

func (m *Manager) SetBit(key string, offset int64, value int) (int, error)

Jump to

Keyboard shortcuts

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