Documentation ¶
Index ¶
- Variables
- func BeginBatchCall(batch Batcher) error
- func CommitCall(batch Batcher) error
- func FlushCall(batch Batcher) error
- func KeyToRoute(key []byte) []byte
- func PrepareCall(batch Batcher) error
- func ResetCall(batch Batcher) error
- func RollbackCall(batch Batcher) error
- func RouteToKey(route []byte) []byte
- type Batch
- func (tb *Batch) BeginBatch() error
- func (tb *Batch) Clone() (*Batch, error)
- func (tb *Batch) Commit() error
- func (tb *Batch) Delete(key []byte) error
- func (tb *Batch) Get(key []byte) ([]byte, error)
- func (tb *Batch) GetData(key []byte, data Serializable) error
- func (tb *Batch) Put(key []byte, value []byte) error
- func (tb *Batch) PutData(key []byte, data Serializable) error
- func (tb *Batch) RollBack() error
- func (tb *Batch) RootHash() ([]byte, error)
- type BatchCallType
- type Batcher
- type Iterator
- type IteratorState
- type Serializable
- type Trie
- func (t *Trie) Clone() (*Trie, error)
- func (t *Trie) Delete(key []byte) error
- func (t *Trie) Flush() error
- func (t *Trie) Get(key []byte) ([]byte, error)
- func (t *Trie) Iterator(prefix []byte) (*Iterator, error)
- func (t *Trie) Keys(prefix []byte) ([][]byte, error)
- func (t *Trie) Prepare() error
- func (t *Trie) Put(key []byte, value []byte) error
- func (t *Trie) Reset() error
- func (t *Trie) RootHash() []byte
- func (t *Trie) SetRootHash(rootHash []byte)
- func (t *Trie) ShowPath(key []byte) []string
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidNodeType = errors.New("invalid node type") ErrPbMsg = errors.New("pb Message cannot be converted into Node") ErrNotFound = storage.ErrKeyNotFound )
Errors
var ( ErrCannotPerformInBatch = errors.New("cannot perform in batch") ErrNotBatching = errors.New("not batching") ErrAlreadyPreparedTrie = errors.New("cannot prepare again") ErrNotPrepared = errors.New("not preparing") ErrCannotClonePreparedTrie = errors.New("cannot clone prepared trie") )
Trie errors string representation
Functions ¶
func BeginBatchCall ¶
BeginBatchCall is a begin batch call.
Types ¶
type Batch ¶
type Batch struct { *Trie // contains filtered or unexported fields }
Batch batch implementation for trie
func (*Batch) GetData ¶
func (tb *Batch) GetData(key []byte, data Serializable) error
GetData get value from trie and set on serializable data
func (*Batch) PutData ¶
func (tb *Batch) PutData(key []byte, data Serializable) error
PutData put serializable data to trie
type BatchCallType ¶
BatchCallType is a type of batch call function.
type Batcher ¶
type Batcher interface { Prepare() error BeginBatch() error Commit() error RollBack() error Flush() error Reset() error }
Batcher is an interface for batch commands.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator to traverse leaf node in a trie
type IteratorState ¶
type IteratorState struct {
// contains filtered or unexported fields
}
IteratorState represents the intermediate statue in iterator
type Serializable ¶
Serializable interface for serializing/deserializing
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie is a Merkle Patricia Trie, consists of three kinds of nodes, Branch Node: 16-elements array, value is [hash_0, hash_1, ..., hash_f, hash] Extension Node: 3-elements array, value is [ext flag, prefix path, next hash] Leaf Node: 3-elements array, value is [leaf flag, suffix path, value]
func (*Trie) SetRootHash ¶
SetRootHash setter for rootHash