package bitseq
import "github.com/docker/libnetwork/bitseq"
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 NewHandle(app string, ds datastore.DataStore, id string, numElements uint64) (*Handle, error)
- func (h *Handle) Bits() uint64
- func (h *Handle) CheckConsistency() error
- 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
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") )
Types ¶
type Handle ¶
Handle contains the sequece representing the bitmask and its identifier
func NewHandle ¶
NewHandle returns a thread-safe instance of the bitmask handler
func (*Handle) Bits ¶
Bits returns the length of the bit sequence
func (*Handle) CheckConsistency ¶
CheckConsistency checks if the bit sequence is in an inconsistent state and attempts to fix it. It looks for a corruption signature that may happen in docker 1.9.0 and 1.9.1.
func (*Handle) CopyTo ¶
CopyTo deep copies the handle into the passed destination object
func (*Handle) DataScope ¶
DataScope method returns the storage scope of the datastore
func (*Handle) Destroy ¶
Destroy removes from the datastore the data belonging to this handle
func (*Handle) Exists ¶
Exists method is true if this object has been stored in the DB.
func (*Handle) FromByteArray ¶
FromByteArray reads his handle's data from a byte array
func (*Handle) Index ¶
Index returns the latest DB Index as seen by this object
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) Key ¶
Key provides the Key to be used in KV Store
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) New ¶
New method returns a handle based on the receiver handle
func (*Handle) Set ¶
Set atomically sets the corresponding bit in the sequence
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) SetValue ¶
SetValue unmarshals the data from the KV store
func (*Handle) Skip ¶
Skip provides a way for a KV Object to avoid persisting it in the KV Store
func (*Handle) String ¶
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
func (*Handle) Unset ¶
Unset atomically unsets the corresponding bit in the sequence
func (*Handle) Value ¶
Value marshals the data to be stored in the KV store
Source Files ¶
- Version
- v0.5.6 (latest)
- Published
- Jan 15, 2016
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 2 hours ago –
Tools for package owners.