storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: LGPL-3.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TrieState

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

TrieState is a wrapper around a transient trie that is used during the course of executing some runtime call. If the execution of the call is successful, the trie will be saved in the StorageState.

func NewTrieState

func NewTrieState(t *trie.Trie) (*TrieState, error)

NewTrieState returns a new TrieState with the given trie

func (*TrieState) ClearChildStorage

func (s *TrieState) ClearChildStorage(keyToChild, key []byte) error

ClearChildStorage removes the child storage entry from the trie

func (*TrieState) ClearPrefix

func (s *TrieState) ClearPrefix(prefix []byte) error

ClearPrefix deletes all key-value pairs from the trie where the key starts with the given prefix

func (*TrieState) ClearPrefixInChild

func (s *TrieState) ClearPrefixInChild(keyToChild, prefix []byte) error

ClearPrefixInChild clears all the keys from the child trie that have the given prefix

func (*TrieState) Copy

func (s *TrieState) Copy() (*TrieState, error)

Copy performs a deep copy of the TrieState

func (*TrieState) Delete

func (s *TrieState) Delete(key []byte) error

Delete deletes a key from the trie

func (*TrieState) DeleteChildStorage

func (s *TrieState) DeleteChildStorage(key []byte) error

DeleteChildStorage deletes child storage from the trie

func (*TrieState) Get

func (s *TrieState) Get(key []byte) ([]byte, error)

Get gets a value from the trie

func (*TrieState) GetBalance

func (s *TrieState) GetBalance(key [32]byte) (uint64, error)

GetBalance returns the balance for a given public key

func (*TrieState) GetChild

func (s *TrieState) GetChild(keyToChild []byte) (*trie.Trie, error)

GetChild returns the child trie at the given key

func (*TrieState) GetChildNextKey

func (s *TrieState) GetChildNextKey(keyToChild, key []byte) ([]byte, error)

GetChildNextKey returns the next lexicographical larger key from child storage. If it does not exist, it returns nil.

func (*TrieState) GetChildStorage

func (s *TrieState) GetChildStorage(keyToChild, key []byte) ([]byte, error)

GetChildStorage returns a value from a child trie

func (*TrieState) GetKeysWithPrefixFromChild

func (s *TrieState) GetKeysWithPrefixFromChild(keyToChild, prefix []byte) ([][]byte, error)

GetKeysWithPrefixFromChild ...

func (*TrieState) Has

func (s *TrieState) Has(key []byte) (bool, error)

Has returns whether or not a key exists

func (*TrieState) LoadCode

func (s *TrieState) LoadCode() ([]byte, error)

LoadCode returns the runtime code (located at :code)

func (*TrieState) LoadCodeHash

func (s *TrieState) LoadCodeHash() (common.Hash, error)

LoadCodeHash returns the hash of the runtime code (located at :code)

func (*TrieState) MustRoot

func (s *TrieState) MustRoot() common.Hash

MustRoot returns the trie's root hash. It panics if it fails to compute the root.

func (*TrieState) NextKey

func (s *TrieState) NextKey(key []byte) []byte

NextKey returns the next key in the trie in lexicographical order. If it does not exist, it returns nil.

func (*TrieState) Root

func (s *TrieState) Root() (common.Hash, error)

Root returns the trie's root hash

func (*TrieState) Set

func (s *TrieState) Set(key []byte, value []byte) error

Set sets a key-value pair in the trie

func (*TrieState) SetBalance

func (s *TrieState) SetBalance(key [32]byte, balance uint64) error

SetBalance sets the balance for a given public key

func (*TrieState) SetChild

func (s *TrieState) SetChild(keyToChild []byte, child *trie.Trie) error

SetChild sets the child trie at the given key

func (*TrieState) SetChildStorage

func (s *TrieState) SetChildStorage(keyToChild, key, value []byte) error

SetChildStorage sets a key-value pair in a child trie

func (*TrieState) Trie

func (s *TrieState) Trie() *trie.Trie

Trie returns the TrieState's underlying trie

func (*TrieState) TrieEntries

func (s *TrieState) TrieEntries() map[string][]byte

TrieEntries returns every key-value pair in the trie

Jump to

Keyboard shortcuts

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