trie

package
v1.0.88 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChildPosOutOfRange = errors.New("the position of the child is out of range")

ErrChildPosOutOfRange is raised when the position of a child in a branch node is less than 0 or greater than 16

View Source
var ErrEmptyNode = errors.New("the node is empty")

ErrEmptyNode is raised when we reach an empty node (a node with no children or no value)

View Source
var ErrHashNotFound = errors.New("hash not found")

ErrHashNotFound signals that the given hash was not found in db or snapshots

View Source
var ErrInvalidEncoding = errors.New("cannot decode this invalid encoding")

ErrInvalidEncoding is raised when the encoded information cannot be decoded

View Source
var ErrInvalidHash = errors.New("the received hash is invalid")

ErrInvalidHash is raised when the given hash is invalid

View Source
var ErrInvalidLength = errors.New("invalid array length")

ErrInvalidLength signals that length of the array is invalid

View Source
var ErrInvalidNode = errors.New("invalid node")

ErrInvalidNode is raised when we reach an invalid node

View Source
var ErrNilDatabase = errors.New("no database provided")

ErrNilDatabase is raised when a database operation is called, but no database is provided

View Source
var ErrNilEvictionWaitingList = errors.New("nil eviction waiting list provided")

ErrNilEvictionWaitingList is raised when a nil eviction waiting list is provided

View Source
var ErrNilHasher = errors.New("no hasher provided")

ErrNilHasher is raised when the NewTrie() function is called, but a hasher isn't provided

View Source
var ErrNilMarshalizer = errors.New("no marshalizer provided")

ErrNilMarshalizer is raised when the NewTrie() function is called, but a marshalizer isn't provided

View Source
var ErrNilNode = errors.New("the node is nil")

ErrNilNode is raised when we reach a nil node

View Source
var ErrNilPathManager = errors.New("nil path manager")

ErrNilPathManager signals that a nil path manager has been provided

View Source
var ErrNilResolver = errors.New("the resolver is nil")

ErrNilResolver is raised when the given resolver is nil

View Source
var ErrNilSnapshotDbConfig = errors.New("nil snapshot db config provided")

ErrNilSnapshotDbConfig is raised when a nil snapshot db config is provided

View Source
var ErrNilTrie = errors.New("the trie is nil")

ErrNilTrie is raised when the trie is nil

View Source
var ErrNilTrieStorage = errors.New("nil trie storage provided")

ErrNilTrieStorage is raised when a nil trie storage is provided

View Source
var ErrNodeNotFound = errors.New("the node is not present in the trie")

ErrNodeNotFound is raised when we try to get a node that is not present in the trie

View Source
var ErrTimeIsOut = errors.New("time is out")

ErrTimeIsOut signals that time is out

View Source
var ErrValueTooShort = errors.New("cannot remove bytes from value because value is too short")

ErrValueTooShort is raised when we try to remove something from a value, and the value is too short

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that wrong type was provided

Functions

func NewIterator

func NewIterator(trie data.Trie) (*iterator, error)

NewIterator creates a new instance of trie iterator

func NewTrie

func NewTrie(
	trieStorage data.StorageManager,
	msh marshal.Marshalizer,
	hsh hashing.Hasher,
) (*patriciaMerkleTrie, error)

NewTrie creates a new Patricia Merkle Trie

func NewTrieStorageManager

func NewTrieStorageManager(db data.DBWriteCacher, snapshotDbCfg *config.DBConfig, ewl data.DBRemoveCacher) (*trieStorageManager, error)

NewTrieStorageManager creates a new instance of trieStorageManager

func NewTrieStorageManagerWithoutPruning

func NewTrieStorageManagerWithoutPruning(db data.DBWriteCacher) (*trieStorageManagerWithoutPruning, error)

NewTrieStorageManagerWithoutPruning creates a new instance of trieStorageManagerWithoutPruning

func NewTrieSyncer

func NewTrieSyncer(
	resolver dataRetriever.Resolver,
	interceptedNodes storage.Cacher,
	trie data.Trie,
	waitTime time.Duration,
) (*trieSyncer, error)

NewTrieSyncer creates a new instance of trieSyncer

Types

type InterceptedTrieNode

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

InterceptedTrieNode implements intercepted data interface and is used when trie nodes are intercepted

func NewInterceptedTrieNode

func NewInterceptedTrieNode(
	buff []byte,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
) (*InterceptedTrieNode, error)

NewInterceptedTrieNode creates a new instance of InterceptedTrieNode

func (*InterceptedTrieNode) CheckValidity

func (inTn *InterceptedTrieNode) CheckValidity() error

CheckValidity checks if the intercepted data is valid

func (*InterceptedTrieNode) CreateEndOfProcessingTriggerNode

func (inTn *InterceptedTrieNode) CreateEndOfProcessingTriggerNode()

CreateEndOfProcessingTriggerNode changes the hash of the current node by appending the hash to the current hash. This construction will be used to trigger the end of processing for all of the received data

func (*InterceptedTrieNode) EncodedNode

func (inTn *InterceptedTrieNode) EncodedNode() []byte

EncodedNode returns the intercepted encoded node

func (*InterceptedTrieNode) Hash

func (inTn *InterceptedTrieNode) Hash() []byte

Hash returns the hash of the intercepted node

func (*InterceptedTrieNode) IsForCurrentShard

func (inTn *InterceptedTrieNode) IsForCurrentShard() bool

IsForCurrentShard checks if the intercepted data is for the current shard

func (*InterceptedTrieNode) IsInterfaceNil

func (inTn *InterceptedTrieNode) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*InterceptedTrieNode) Type

func (inTn *InterceptedTrieNode) Type() string

Type returns the type of this intercepted data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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