collections

package
v1.0.4-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArrayOverflow = errors.New("Array overflow")

Functions

func ArrayElemKey

func ArrayElemKey(name string, index uint32) kv.Key

func MapElemKey added in v0.3.0

func MapElemKey(name string, key []byte) kv.Key

Types

type Array

type Array struct {
	*ArrayReadOnly
	// contains filtered or unexported fields
}

Array represents a dynamic array stored in a kv.KVStore

func NewArray

func NewArray(kvStore kv.KVStore, name string) *Array

func (*Array) Erase

func (a *Array) Erase()

func (*Array) Extend

func (a *Array) Extend(other *ArrayReadOnly)

func (*Array) Immutable

func (a *Array) Immutable() *ArrayReadOnly

func (*Array) PruneAt added in v1.0.3

func (a *Array) PruneAt(index uint32)

PruneAt deletes the value at the given index, without shifting the rest of the values.

func (*Array) Push

func (a *Array) Push(value []byte)

adds to the end of the list

func (*Array) SetAt

func (a *Array) SetAt(index uint32, value []byte)

type ArrayReadOnly added in v1.0.3

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

ArrayReadOnly provides read-only access to an Array in a kv.KVStoreReader.

func NewArrayReadOnly

func NewArrayReadOnly(kvReader kv.KVStoreReader, name string) *ArrayReadOnly

func (*ArrayReadOnly) GetAt added in v1.0.3

func (a *ArrayReadOnly) GetAt(index uint32) []byte

func (*ArrayReadOnly) Len added in v1.0.3

func (a *ArrayReadOnly) Len() uint32

Len == 0/empty/non-existent are equivalent

type ImmutableMap

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

ImmutableMap provides read-only access to a Map in a kv.KVStoreReader.

func NewMapReadOnly

func NewMapReadOnly(kvReader kv.KVStoreReader, name string) *ImmutableMap

func (*ImmutableMap) GetAt

func (m *ImmutableMap) GetAt(key []byte) []byte

func (*ImmutableMap) HasAt

func (m *ImmutableMap) HasAt(key []byte) bool

func (*ImmutableMap) Iterate

func (m *ImmutableMap) Iterate(f func(elemKey []byte, value []byte) bool)

Iterate non-deterministic

func (*ImmutableMap) IterateKeys

func (m *ImmutableMap) IterateKeys(f func(elemKey []byte) bool)

IterateKeys non-deterministic

func (*ImmutableMap) Keys added in v1.0.3

func (m *ImmutableMap) Keys() [][]byte

func (*ImmutableMap) Len

func (m *ImmutableMap) Len() uint32

func (*ImmutableMap) Name

func (m *ImmutableMap) Name() string

type Map

type Map struct {
	*ImmutableMap
	// contains filtered or unexported fields
}

Map represents a dynamic key-value collection in a kv.KVStore.

func NewMap

func NewMap(kvStore kv.KVStore, name string) *Map

func (*Map) DelAt

func (m *Map) DelAt(key []byte)

func (*Map) Erase

func (m *Map) Erase()

Erase the map.

func (*Map) Immutable

func (m *Map) Immutable() *ImmutableMap

func (*Map) Keys added in v1.0.3

func (m *Map) Keys() [][]byte

func (*Map) SetAt

func (m *Map) SetAt(key, value []byte)

Jump to

Keyboard shortcuts

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