kv

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthKv        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowKv          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupKv = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Element

type Element struct {

	// The value stored with this element.
	Value *Pair
	// contains filtered or unexported fields
}

Element is an element of a linked list.

func (*Element) Next

func (e *Element) Next() *Element

Next returns the next list element or nil.

func (*Element) Prev

func (e *Element) Prev() *Element

Prev returns the previous list element or nil.

type List

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

List represents a doubly linked list. The zero value for List is an empty list ready to use.

func NewList

func NewList() *List

NewList returns an initialized list.

func (*List) Back

func (l *List) Back() *Element

Back returns the last element of list l or nil if the list is empty.

func (*List) Front

func (l *List) Front() *Element

Front returns the first element of list l or nil if the list is empty.

func (*List) Init

func (l *List) Init() *List

Init initializes or clears list l.

func (*List) InsertAfter

func (l *List) InsertAfter(v *Pair, mark *Element) *Element

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*List) InsertBefore

func (l *List) InsertBefore(v *Pair, mark *Element) *Element

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.

func (*List) Len

func (l *List) Len() int

Len returns the number of elements of list l. The complexity is O(1).

func (*List) MoveAfter

func (l *List) MoveAfter(e, mark *Element)

MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*List) MoveBefore

func (l *List) MoveBefore(e, mark *Element)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.

func (*List) MoveToBack

func (l *List) MoveToBack(e *Element)

MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*List) MoveToFront

func (l *List) MoveToFront(e *Element)

MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.

func (*List) PushBack

func (l *List) PushBack(v *Pair) *Element

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*List) PushBackList

func (l *List) PushBackList(other *List)

PushBackList inserts a copy of another list at the back of list l. The lists l and other may be the same. They must not be nil.

func (*List) PushFront

func (l *List) PushFront(v *Pair) *Element

PushFront inserts a new element e with value v at the front of list l and returns e.

func (*List) PushFrontList

func (l *List) PushFrontList(other *List)

PushFrontList inserts a copy of another list at the front of list l. The lists l and other may be the same. They must not be nil.

func (*List) Remove

func (l *List) Remove(e *Element) *Pair

Remove removes e from l if e is an element of list l. It returns the element value e.Value. The element must not be nil.

type Pair

type Pair struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

Pair defines a key/value bytes tuple.

func (*Pair) Descriptor

func (*Pair) Descriptor() ([]byte, []int)

func (*Pair) GetKey

func (m *Pair) GetKey() []byte

func (*Pair) GetValue

func (m *Pair) GetValue() []byte

func (*Pair) Marshal

func (m *Pair) Marshal() (dAtA []byte, err error)

func (*Pair) MarshalTo

func (m *Pair) MarshalTo(dAtA []byte) (int, error)

func (*Pair) MarshalToSizedBuffer

func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Pair) ProtoMessage

func (*Pair) ProtoMessage()

func (*Pair) Reset

func (m *Pair) Reset()

func (*Pair) Size

func (m *Pair) Size() (n int)

func (*Pair) String

func (m *Pair) String() string

func (*Pair) Unmarshal

func (m *Pair) Unmarshal(dAtA []byte) error

func (*Pair) XXX_DiscardUnknown

func (m *Pair) XXX_DiscardUnknown()

func (*Pair) XXX_Marshal

func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pair) XXX_Merge

func (m *Pair) XXX_Merge(src proto.Message)

func (*Pair) XXX_Size

func (m *Pair) XXX_Size() int

func (*Pair) XXX_Unmarshal

func (m *Pair) XXX_Unmarshal(b []byte) error

type Pairs

type Pairs struct {
	Pairs []Pair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"`
}

Pairs defines a repeated slice of Pair objects.

func (*Pairs) Descriptor

func (*Pairs) Descriptor() ([]byte, []int)

func (*Pairs) GetPairs

func (m *Pairs) GetPairs() []Pair

func (Pairs) Len

func (kvs Pairs) Len() int

func (Pairs) Less

func (kvs Pairs) Less(i, j int) bool

func (*Pairs) Marshal

func (m *Pairs) Marshal() (dAtA []byte, err error)

func (*Pairs) MarshalTo

func (m *Pairs) MarshalTo(dAtA []byte) (int, error)

func (*Pairs) MarshalToSizedBuffer

func (m *Pairs) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Pairs) ProtoMessage

func (*Pairs) ProtoMessage()

func (*Pairs) Reset

func (m *Pairs) Reset()

func (*Pairs) Size

func (m *Pairs) Size() (n int)

func (Pairs) Sort

func (kvs Pairs) Sort()

Sort invokes sort.Sort on kvs.

func (*Pairs) String

func (m *Pairs) String() string

func (Pairs) Swap

func (kvs Pairs) Swap(i, j int)

func (*Pairs) Unmarshal

func (m *Pairs) Unmarshal(dAtA []byte) error

func (*Pairs) XXX_DiscardUnknown

func (m *Pairs) XXX_DiscardUnknown()

func (*Pairs) XXX_Marshal

func (m *Pairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pairs) XXX_Merge

func (m *Pairs) XXX_Merge(src proto.Message)

func (*Pairs) XXX_Size

func (m *Pairs) XXX_Size() int

func (*Pairs) XXX_Unmarshal

func (m *Pairs) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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