collections

package
v0.6.1-alpha.17 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArray16Overflow = errors.New("Array16 overflow")
View Source
var ErrArray32Overflow = errors.New("Array32 overflow")

Functions

func Array16RangeKeys added in v0.2.0

func Array16RangeKeys(name string, length, from, to uint16) []kv.Key

Array16RangeKeys returns the KVStore keys for the items between [from, to) (`to` being not inclusive), assuming it has `length` elements.

func Array32ElemKey added in v0.3.0

func Array32ElemKey(name string, idx uint32) kv.Key

func Array32RangeKeys added in v0.2.0

func Array32RangeKeys(name string, length, from, to uint32) []kv.Key

Array32RangeKeys returns the KVStore keys for the items between [from, to) (`to` being not inclusive), assuming it has `length` elements.

func Array32SizeKey added in v0.3.0

func Array32SizeKey(name string) kv.Key

func MapElemKey added in v0.3.0

func MapElemKey(mapName string, keyInMap []byte) []byte

func MapSizeKey added in v0.3.0

func MapSizeKey(mapName string) []byte

Types

type Array16 added in v0.2.0

type Array16 struct {
	*ImmutableArray16
	// contains filtered or unexported fields
}

Array16 represents a dynamic array stored in a kv.KVStore

func NewArray16 added in v0.2.0

func NewArray16(kvStore kv.KVStore, name string) *Array16

func (*Array16) Erase added in v0.2.0

func (a *Array16) Erase()

TODO implement with DelPrefix

func (*Array16) Extend added in v0.2.0

func (a *Array16) Extend(other *ImmutableArray16)

func (*Array16) Immutable added in v0.2.0

func (a *Array16) Immutable() *ImmutableArray16

func (*Array16) Push added in v0.2.0

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

adds to the end of the list

func (*Array16) SetAt added in v0.2.0

func (a *Array16) SetAt(idx uint16, value []byte)

type Array32 added in v0.2.0

type Array32 struct {
	*ImmutableArray32
	// contains filtered or unexported fields
}

Array32 represents a dynamic array stored in a kv.KVStore

func NewArray32 added in v0.2.0

func NewArray32(kvStore kv.KVStore, name string) *Array32

func (*Array32) Erase added in v0.2.0

func (a *Array32) Erase()

TODO implement with DelPrefix

func (*Array32) Extend added in v0.2.0

func (a *Array32) Extend(other *ImmutableArray32)

func (*Array32) Immutable added in v0.2.0

func (a *Array32) Immutable() *ImmutableArray32

func (*Array32) Push added in v0.2.0

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

adds to the end of the list

func (*Array32) SetAt added in v0.2.0

func (a *Array32) SetAt(idx uint32, value []byte)

type ImmutableArray16 added in v0.2.0

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

ImmutableArray16 provides read-only access to an Array16 in a kv.KVStoreReader.

func NewArray16ReadOnly added in v0.2.0

func NewArray16ReadOnly(kvReader kv.KVStoreReader, name string) *ImmutableArray16

func (*ImmutableArray16) GetAt added in v0.2.0

func (a *ImmutableArray16) GetAt(idx uint16) []byte

func (*ImmutableArray16) Len added in v0.2.0

func (a *ImmutableArray16) Len() uint16

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

type ImmutableArray32 added in v0.2.0

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

ImmutableArray32 provides read-only access to an Array32 in a kv.KVStoreReader.

func NewArray32ReadOnly added in v0.2.0

func NewArray32ReadOnly(kvReader kv.KVStoreReader, name string) *ImmutableArray32

func (*ImmutableArray32) GetAt added in v0.2.0

func (a *ImmutableArray32) GetAt(idx uint32) []byte

func (*ImmutableArray32) Len added in v0.2.0

func (a *ImmutableArray32) 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) 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) 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