state

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeBindingInfo

func EncodeBindingInfo(info *BindingInfo) []byte

Types

type BindingInfo

type BindingInfo struct {
	Amount int64
}

TODO:

func DecodeBindingInfo

func DecodeBindingInfo(buf []byte) *BindingInfo

type Database

type Database interface {
	OpenBindingTrie(root common.Hash) (Trie, error)

	// CopyTrie returns an independent copy of the given trie.
	CopyTrie(Trie) Trie

	// TrieDB retrieves the low level trie database used for data storage.
	TrieDB() *trie.Database
}

Database wraps access to tries and contract code.

func NewDatabase

func NewDatabase(db massdb.Database) Database

NewDatabase creates a backing store for state. The returned database is safe for concurrent use, but does not retain any recent trie nodes in memory. To keep some historical state in memory, use the NewDatabaseWithConfig constructor.

type Trie

type Trie interface {

	// TryGet returns the value for key stored in the trie. The value bytes must
	// not be modified by the caller. If a node was not found in the database, a
	// trie.MissingNodeError is returned.
	TryGet(key []byte) ([]byte, error)

	// TryUpdate associates key with value in the trie. If value has length zero, any
	// existing value is deleted from the trie. The value bytes must not be modified
	// by the caller while they are stored in the trie. If a node was not found in the
	// database, a trie.MissingNodeError is returned.
	TryUpdate(key, value []byte) error

	// TryDelete removes any existing value for key from the trie. If a node was not
	// found in the database, a trie.MissingNodeError is returned.
	TryDelete(key []byte) error

	// Hash returns the root hash of the trie. It does not write to the database and
	// can be used even if the trie doesn't have one.
	Hash() common.Hash

	// Commit writes all nodes to the database.
	Commit() (common.Hash, error)

	// NodeIterator returns an iterator that returns nodes of the trie. Iteration
	// starts at the key after the given start key.
	NodeIterator(startKey []byte) trie.NodeIterator
}

Trie is a Ethereum Merkle Patricia trie.

Jump to

Keyboard shortcuts

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