docker: github.com/docker/docker/vendor/github.com/docker/libnetwork/bitseq Index | Files

package bitseq

import "github.com/docker/docker/vendor/github.com/docker/libnetwork/bitseq"

Package bitseq provides a structure and utilities for representing long bitmask as sequence of run-length encoded blocks. It operates directly on the encoded representation, it does not decode/encode.

Index

Package Files

sequence.go store.go

Variables

var (
    // ErrNoBitAvailable is returned when no more bits are available to set
    ErrNoBitAvailable = errors.New("no bit available")
    // ErrBitAllocated is returned when the specific bit requested is already set
    ErrBitAllocated = errors.New("requested bit is already allocated")
)

type Handle Uses

type Handle struct {
    sync.Mutex
    // contains filtered or unexported fields
}

Handle contains the sequence representing the bitmask and its identifier

func NewHandle Uses

func NewHandle(app string, ds datastore.DataStore, id string, numElements uint64) (*Handle, error)

NewHandle returns a thread-safe instance of the bitmask handler

func (*Handle) Bits Uses

func (h *Handle) Bits() uint64

Bits returns the length of the bit sequence

func (*Handle) CheckConsistency Uses

func (h *Handle) CheckConsistency() error

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 Uses

func (h *Handle) CopyTo(o datastore.KVObject) error

CopyTo deep copies the handle into the passed destination object

func (*Handle) DataScope Uses

func (h *Handle) DataScope() string

DataScope method returns the storage scope of the datastore

func (*Handle) Destroy Uses

func (h *Handle) Destroy() error

Destroy removes from the datastore the data belonging to this handle

func (*Handle) Exists Uses

func (h *Handle) Exists() bool

Exists method is true if this object has been stored in the DB.

func (*Handle) FromByteArray Uses

func (h *Handle) FromByteArray(ba []byte) error

FromByteArray reads his handle's data from a byte array

func (*Handle) Index Uses

func (h *Handle) Index() uint64

Index returns the latest DB Index as seen by this object

func (*Handle) IsSet Uses

func (h *Handle) IsSet(ordinal uint64) bool

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 Uses

func (h *Handle) Key() []string

Key provides the Key to be used in KV Store

func (*Handle) KeyPrefix Uses

func (h *Handle) KeyPrefix() []string

KeyPrefix returns the immediate parent key that can be used for tree walk

func (*Handle) MarshalJSON Uses

func (h *Handle) MarshalJSON() ([]byte, error)

MarshalJSON encodes Handle into json message

func (*Handle) New Uses

func (h *Handle) New() datastore.KVObject

New method returns a handle based on the receiver handle

func (*Handle) Set Uses

func (h *Handle) Set(ordinal uint64) error

Set atomically sets the corresponding bit in the sequence

func (*Handle) SetAny Uses

func (h *Handle) SetAny(serial bool) (uint64, error)

SetAny atomically sets the first unset bit in the sequence and returns the corresponding ordinal

func (*Handle) SetAnyInRange Uses

func (h *Handle) SetAnyInRange(start, end uint64, serial bool) (uint64, error)

SetAnyInRange atomically sets the first unset bit in the specified range in the sequence and returns the corresponding ordinal

func (*Handle) SetIndex Uses

func (h *Handle) SetIndex(index uint64)

SetIndex method allows the datastore to store the latest DB Index into this object

func (*Handle) SetValue Uses

func (h *Handle) SetValue(value []byte) error

SetValue unmarshals the data from the KV store

func (*Handle) Skip Uses

func (h *Handle) Skip() bool

Skip provides a way for a KV Object to avoid persisting it in the KV Store

func (*Handle) String Uses

func (h *Handle) String() string

func (*Handle) ToByteArray Uses

func (h *Handle) ToByteArray() ([]byte, error)

ToByteArray converts this handle's data into a byte array

func (*Handle) UnmarshalJSON Uses

func (h *Handle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes json message into Handle

func (*Handle) Unselected Uses

func (h *Handle) Unselected() uint64

Unselected returns the number of bits which are not selected

func (*Handle) Unset Uses

func (h *Handle) Unset(ordinal uint64) error

Unset atomically unsets the corresponding bit in the sequence

func (*Handle) Value Uses

func (h *Handle) Value() []byte

Value marshals the data to be stored in the KV store

Package bitseq imports 8 packages (graph). Updated 2019-04-17. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).