treestore

package
v0.4.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TreeStore

type TreeStore struct {
	*trie.Trie
	// contains filtered or unexported fields
}

func NewTreeStore

func NewTreeStore(root common.Hash, db database.Database) *TreeStore

NewTreeStore create a new instance of TreeStore.

func (*TreeStore) Commit

func (store *TreeStore) Commit() (common.Hash, error)

func (*TreeStore) Copy

func (store *TreeStore) Copy() (*TreeStore, error)

Copy returns a copy of the TreeStore

func (*TreeStore) Delete

func (store *TreeStore) Delete(key common.Bytes) (deleted bool)

Delete deletes the key/value pair.

func (*TreeStore) Get

func (store *TreeStore) Get(key common.Bytes) common.Bytes

Get retrieves value of given key.

func (*TreeStore) GetDB

func (store *TreeStore) GetDB() database.Database

GetDB returns the underlying database.

func (*TreeStore) ProveVCP

func (store *TreeStore) ProveVCP(vcpKey []byte, vp *core.VCPProof) error

func (*TreeStore) Prune

func (store *TreeStore) Prune(cb func(n []byte) bool) error

Prune deletes all non-referenced nodes.

func (*TreeStore) Revert

func (store *TreeStore) Revert(root common.Hash) (*TreeStore, error)

Revert creates a copy of the Trie with the given root, using the in-memory trie DB (i.e. store.Trie.GetDB()) of the current Trie. Note: Each time we call Trie.Commit() a new root node will be created, however, the older roots are still stored in the in-memory trie DB. The root passed to the Revert() function needs to be one of the previous roots, otherwise the function will return an error.

func (*TreeStore) Set

func (store *TreeStore) Set(key, value common.Bytes)

Set sets value of given key.

func (*TreeStore) Traverse

func (store *TreeStore) Traverse(prefix common.Bytes, cb func(k, v common.Bytes) bool) bool

Traverse traverses the trie and calls cb callback func on every key/value pair with key having prefix

Jump to

Keyboard shortcuts

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