Documentation ¶
Overview ¶
Package trie implements Merkle Patricia Tries
Index ¶
- Variables
- func VerifyProof(rootHash common.Hash, key []byte, proofDb neatdb.Reader) (value []byte, nodes int, err error)
- type Database
- func (db *Database) Cap(limit common.StorageSize) error
- func (db *Database) Commit(node common.Hash, report bool) error
- func (db *Database) Dereference(root common.Hash)
- func (db *Database) DiskDB() neatdb.Reader
- func (db *Database) InsertBlob(hash common.Hash, blob []byte)
- func (db *Database) Node(hash common.Hash) ([]byte, error)
- func (db *Database) Nodes() []common.Hash
- func (db *Database) Reference(side common.Hash, parent common.Hash)
- func (db *Database) Size() (common.StorageSize, common.StorageSize)
- type Iterator
- type LeafCallback
- type MissingNodeError
- type NodeIterator
- type SecureTrie
- func (t *SecureTrie) Commit(onleaf LeafCallback) (root common.Hash, err error)
- func (t *SecureTrie) Copy() *SecureTrie
- func (t *SecureTrie) Delete(key []byte)
- func (t *SecureTrie) Get(key []byte) []byte
- func (t *SecureTrie) GetKey(shaKey []byte) []byte
- func (t *SecureTrie) Hash() common.Hash
- func (t *SecureTrie) NodeIterator(start []byte) NodeIterator
- func (t *SecureTrie) Prove(key []byte, fromLevel uint, proofDb neatdb.Writer) error
- func (t *SecureTrie) TryDelete(key []byte) error
- func (t *SecureTrie) TryGet(key []byte) ([]byte, error)
- func (t *SecureTrie) TryUpdate(key, value []byte) error
- func (t *SecureTrie) Update(key, value []byte)
- type Sync
- func (s *Sync) AddRawEntry(hash common.Hash, depth int, parent common.Hash)
- func (s *Sync) AddSubTrie(root common.Hash, depth int, parent common.Hash, callback LeafCallback)
- func (s *Sync) Commit(dbw neatdb.Writer) (int, error)
- func (s *Sync) Missing(max int) []common.Hash
- func (s *Sync) Pending() int
- func (s *Sync) Process(results []SyncResult) (bool, int, error)
- type SyncResult
- type Trie
- func (t *Trie) Commit(onleaf LeafCallback) (root common.Hash, err error)
- func (t *Trie) Delete(key []byte)
- func (t *Trie) Get(key []byte) []byte
- func (t *Trie) Hash() common.Hash
- func (t *Trie) NodeIterator(start []byte) NodeIterator
- func (t *Trie) Prove(key []byte, fromLevel uint, proofDb neatdb.Writer) error
- func (t *Trie) TryDelete(key []byte) error
- func (t *Trie) TryGet(key []byte) ([]byte, error)
- func (t *Trie) TryUpdate(key, value []byte) error
- func (t *Trie) Update(key, value []byte)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadyProcessed = errors.New("already processed")
View Source
var ErrNotRequested = errors.New("not requested")
Functions ¶
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
func NewDatabase(diskdb neatdb.KeyValueStore) *Database
func NewDatabaseWithCache ¶
func NewDatabaseWithCache(diskdb neatdb.KeyValueStore, cache int) *Database
func (*Database) Dereference ¶
func (*Database) Size ¶
func (db *Database) Size() (common.StorageSize, common.StorageSize)
type Iterator ¶
type Iterator struct { Key []byte Value []byte Err error // contains filtered or unexported fields }
func NewIterator ¶
func NewIterator(it NodeIterator) *Iterator
type MissingNodeError ¶
func (*MissingNodeError) Error ¶
func (err *MissingNodeError) Error() string
type NodeIterator ¶
type NodeIterator interface { Next(bool) bool Error() error Hash() common.Hash Parent() common.Hash Path() []byte Leaf() bool LeafKey() []byte LeafBlob() []byte LeafProof() [][]byte }
func NewDifferenceIterator ¶
func NewDifferenceIterator(a, b NodeIterator) (NodeIterator, *int)
func NewUnionIterator ¶
func NewUnionIterator(iters []NodeIterator) (NodeIterator, *int)
type SecureTrie ¶
type SecureTrie struct {
// contains filtered or unexported fields
}
func (*SecureTrie) Commit ¶
func (t *SecureTrie) Commit(onleaf LeafCallback) (root common.Hash, err error)
func (*SecureTrie) Copy ¶
func (t *SecureTrie) Copy() *SecureTrie
func (*SecureTrie) Delete ¶
func (t *SecureTrie) Delete(key []byte)
func (*SecureTrie) Get ¶
func (t *SecureTrie) Get(key []byte) []byte
func (*SecureTrie) GetKey ¶
func (t *SecureTrie) GetKey(shaKey []byte) []byte
func (*SecureTrie) Hash ¶
func (t *SecureTrie) Hash() common.Hash
func (*SecureTrie) NodeIterator ¶
func (t *SecureTrie) NodeIterator(start []byte) NodeIterator
func (*SecureTrie) TryDelete ¶
func (t *SecureTrie) TryDelete(key []byte) error
func (*SecureTrie) TryUpdate ¶
func (t *SecureTrie) TryUpdate(key, value []byte) error
func (*SecureTrie) Update ¶
func (t *SecureTrie) Update(key, value []byte)
type Sync ¶
type Sync struct {
// contains filtered or unexported fields
}
func (*Sync) AddRawEntry ¶
func (*Sync) AddSubTrie ¶
type SyncResult ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
func (*Trie) NodeIterator ¶
func (t *Trie) NodeIterator(start []byte) NodeIterator
Click to show internal directories.
Click to hide internal directories.