trie

package
v0.0.0-...-5f8ca62 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Trie

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

func NewTrie

func NewTrie(storage storage.Storage) *Trie

func (*Trie) Commit

func (t *Trie) Commit() []byte

Commit saves the trie in persistent storage and returns the trie root key.

func (*Trie) DecodeNode

func (t *Trie) DecodeNode(hash []byte) (nodes2.Node, error)

func (*Trie) Del

func (t *Trie) Del(key []byte) error

Del removes the key from the trie

func (*Trie) GenerateProof

func (t *Trie) GenerateProof(root nodes2.Node, key []byte) (storage.Storage, error)

func (*Trie) Get

func (t *Trie) Get(key []byte) ([]byte, error)

Get retrieves the value associated with a given key in the trie

func (*Trie) GetRootHash

func (t *Trie) GetRootHash() ([]byte, error)

GetRootHash retrieves the root hash from the Committer. If it's not present in memory, it tries to fetch from the key-value storage.

func (*Trie) Hash

func (t *Trie) Hash() []byte

func (*Trie) NodeHash

func (t *Trie) NodeHash(node nodes2.Node) []byte

func (*Trie) NodeRaw

func (t *Trie) NodeRaw(node nodes2.Node, forHashing bool) interface{}

func (*Trie) Proof

func (t *Trie) Proof(key []byte) (storage.Storage, error)

Proof returns the Merkle-proof associated with a node. An error is returned if the node is not found.

func (*Trie) Put

func (t *Trie) Put(key []byte, value []byte)

Put inserts or updates a value associated with a given key in the trie

func (*Trie) SetRootHash

func (t *Trie) SetRootHash(hash []byte) error

SetRootHash saves the root hash in the Committer and also in the key-value storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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