Documentation ¶
Overview ¶
Package bitseq provides a structure and utilities for representing long bitmask as sequence of run-lenght encoded blocks. It operates direclty on the encoded representation, it does not decode/encode.
Index ¶
- Variables
- type Handle
- func (h *Handle) Bits() uint64
- func (h *Handle) CopyTo(o datastore.KVObject) error
- func (h *Handle) DataScope() string
- func (h *Handle) Destroy() error
- func (h *Handle) Exists() bool
- func (h *Handle) FromByteArray(ba []byte) error
- func (h *Handle) Index() uint64
- func (h *Handle) IsSet(ordinal uint64) bool
- func (h *Handle) Key() []string
- func (h *Handle) KeyPrefix() []string
- func (h *Handle) MarshalJSON() ([]byte, error)
- func (h *Handle) New() datastore.KVObject
- func (h *Handle) Set(ordinal uint64) error
- func (h *Handle) SetAny() (uint64, error)
- func (h *Handle) SetAnyInRange(start, end uint64) (uint64, error)
- func (h *Handle) SetIndex(index uint64)
- func (h *Handle) SetValue(value []byte) error
- func (h *Handle) Skip() bool
- func (h *Handle) String() string
- func (h *Handle) ToByteArray() ([]byte, error)
- func (h *Handle) UnmarshalJSON(data []byte) error
- func (h *Handle) Unselected() uint64
- func (h *Handle) Unset(ordinal uint64) error
- func (h *Handle) Value() []byte
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoBitAvailable is returned when no more bits are available to set ErrNoBitAvailable = fmt.Errorf("no bit available") // ErrBitAllocated is returned when the specific bit requested is already set ErrBitAllocated = fmt.Errorf("requested bit is already allocated") )
Functions ¶
This section is empty.
Types ¶
type Handle ¶
Handle contains the sequece representing the bitmask and its identifier
func (*Handle) FromByteArray ¶
FromByteArray reads his handle's data from a byte array
func (*Handle) IsSet ¶
IsSet atomically checks if the ordinal bit is set. In case ordinal is outside of the bit sequence limits, false is returned.
func (*Handle) KeyPrefix ¶
KeyPrefix returns the immediate parent key that can be used for tree walk
func (*Handle) MarshalJSON ¶
MarshalJSON encodes Handle into json message
func (*Handle) SetAny ¶
SetAny atomically sets the first unset bit in the sequence and returns the corresponding ordinal
func (*Handle) SetAnyInRange ¶
SetAnyInRange atomically sets the first unset bit in the specified range in the sequence and returns the corresponding ordinal
func (*Handle) SetIndex ¶
SetIndex method allows the datastore to store the latest DB Index into this object
func (*Handle) ToByteArray ¶
ToByteArray converts this handle's data into a byte array
func (*Handle) UnmarshalJSON ¶
UnmarshalJSON decodes json message into Handle
func (*Handle) Unselected ¶
Unselected returns the number of bits which are not selected