ads

package module
v0.0.0-...-15a9106 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0, BSD-2-Clause Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	PrefixRawKeysStorage uint8 = iota
	PrefixSMTKeysStorage
	PrefixSMTValuesStorage
	PrefixRootKey
	PrefixSizeKey
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K, V serializer.Byter, KPtr serializer.MarshalablePtr[K], VPtr serializer.MarshalablePtr[V]] struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap[K, V serializer.Byter, KPtr serializer.MarshalablePtr[K], VPtr serializer.MarshalablePtr[V]](store kvstore.KVStore) (newMap *Map[K, V, KPtr, VPtr])

func (*Map[K, V, KPtr, VPtr]) Delete

func (m *Map[K, V, KPtr, VPtr]) Delete(key K) (deleted bool)

Delete removes the key from the map.

func (*Map[K, V, KPtr, VPtr]) Get

func (m *Map[K, V, KPtr, VPtr]) Get(key K) (value VPtr, exists bool)

Get returns the value for the given key.

func (*Map[K, V, KPtr, VPtr]) Has

func (m *Map[K, V, KPtr, VPtr]) Has(key K) (has bool)

Has returns true if the key is in the set.

func (*Map[K, V, KPtr, VPtr]) Root

func (m *Map[K, V, KPtr, VPtr]) Root() (root types.Identifier)

Root returns the root of the state sparse merkle tree at the latest committed slot.

func (*Map[K, V, KPtr, VPtr]) Set

func (m *Map[K, V, KPtr, VPtr]) Set(key K, value VPtr)

Set sets the output to unspent outputs set.

func (*Map[K, V, KPtr, VPtr]) Stream

func (m *Map[K, V, KPtr, VPtr]) Stream(callback func(key K, value VPtr) bool) (err error)

Stream streams all the keys and values.

type Set

type Set[K any, KPtr serializer.MarshalablePtr[K]] struct {
	// contains filtered or unexported fields
}

Set is a sparse merkle tree based set.

func NewSet

func NewSet[K any, KPtr serializer.MarshalablePtr[K]](store kvstore.KVStore) (newSet *Set[K, KPtr])

NewSet creates a new sparse merkle tree based set.

func (*Set[K, KPtr]) Add

func (s *Set[K, KPtr]) Add(key K)

Add adds the key to the set.

func (*Set[K, KPtr]) Delete

func (s *Set[K, KPtr]) Delete(key K) (deleted bool)

Delete removes the key from the set.

func (*Set[K, KPtr]) Has

func (s *Set[K, KPtr]) Has(key K) (has bool)

Has returns true if the key is in the set.

func (*Set[K, KPtr]) Root

func (s *Set[K, KPtr]) Root() (root types.Identifier)

Root returns the root of the state sparse merkle tree at the latest committed slot.

func (*Set[K, KPtr]) Size

func (s *Set[K, KPtr]) Size() (size int)

Size returns the number of elements in the set.

func (*Set[K, KPtr]) Stream

func (s *Set[K, KPtr]) Stream(callback func(key K) bool) (err error)

Stream iterates over the set and calls the callback for each element.

Jump to

Keyboard shortcuts

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