Documentation ¶
Overview ¶
Package basedb
@author: xwc1125
Package basedb ¶
@author: xwc1125
Package basedb ¶
@author: xwc1125
Package basedb ¶
@author: xwc1125
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // OpenTree 打开主账户树 OpenTree(root types.Hash) (Tree, error) // OpenStorageTree 打开账户树 OpenStorageTree(addrHash types.Hash, root types.Hash) (Tree, error) // CopyTree 复制树 CopyTree(Tree) Tree // ContractCode 获取合约的bytes ContractCode(addrHash, codeHash types.Hash) ([]byte, error) // ContractCodeSize 获取合约的bytes长度 ContractCodeSize(addrHash, codeHash types.Hash) (int, error) // TreeDB 获取tree database TreeDB() *tree.Database }
func NewDatabase ¶
type Journal ¶
type Journal struct { Dirties map[string]int // Dirty accounts and the number of changes Pending map[string]struct{} Committer map[string]JournalCommitter // contains filtered or unexported fields }
func (*Journal) Append ¶
func (j *Journal) Append(entry JournalEntry, commiter JournalCommitter)
Append inserts a new modification entry to the end of the change journal.
func (*Journal) ClearDirties ¶
func (j *Journal) ClearDirties()
func (*Journal) Dirty ¶
Dirty explicitly sets an address to dirty, even if the change entries would otherwise suggest it as clean. This method is an ugly hack to handle the RIPEMD precompile consensus exception.
type JournalCommitter ¶
type JournalEntry ¶
type JournalEntry interface { Revert() Dirtied() string }
type Tree ¶
type Tree interface { GetKey([]byte) []byte // 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() types.Hash // Commit writes all nodes to the trie's memory database, tracking the internal // and external (for account tries) references. Commit(onleaf tree.LeafCallback) (types.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) tree.NodeIterator // Prove constructs a Merkle proof for key. The result contains all encoded nodes // on the path to the value at key. The value itself is also included in the last // node and can be retrieved by verifying the proof. // // If the trie does not contain a value for key, the returned proof contains all // nodes of the longest existing prefix of the key (at least the root), ending // with the node that proves the absence of the key. Prove(key []byte, fromLevel uint, proofDb kvstore.KeyValueWriter) error }
Click to show internal directories.
Click to hide internal directories.