slotsmgr

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ClusterSlots = 16384

Variables

View Source
var IndexOutOfBoundError = errors.New("index should be less than max size")
View Source
var IndexRangeError = errors.New("end index should be equal or greater than start index")

Functions

This section is empty.

Types

type BitSet

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

func NewBitSet

func NewBitSet(size uint64) *BitSet

func (*BitSet) Count

func (bs *BitSet) Count() uint64

func (*BitSet) Get

func (bs *BitSet) Get(index uint64) (bool, error)

func (*BitSet) Set

func (bs *BitSet) Set(index uint64, value bool) (oldValue bool, err error)

type SlotPair

type SlotPair struct {
	Start uint64
	End   uint64
}

SlotPair means a range of [start, end]

func (SlotPair) Count

func (sp SlotPair) Count() uint64

func (SlotPair) String

func (sp SlotPair) String() string

type SlotsManager

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

func NewSlotsManager

func NewSlotsManager() *SlotsManager

func (*SlotsManager) Count

func (hs *SlotsManager) Count() uint64

func (*SlotsManager) Get

func (hs *SlotsManager) Get(index uint64) (bool, error)

func (*SlotsManager) Set

func (hs *SlotsManager) Set(index uint64, value bool) (bool, error)

func (*SlotsManager) SetRange

func (hs *SlotsManager) SetRange(pair SlotPair, value bool) error

func (*SlotsManager) ToSlotPair

func (hs *SlotsManager) ToSlotPair() []SlotPair

Jump to

Keyboard shortcuts

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