trie

package
v0.0.0-...-0c41aae Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0, GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagHashNode        = 0
	TagValueNode       = 1
	TagShortNode       = 2
	TagFullNode        = 17
	LenOfChildrenNodes = 17
)

Variables

This section is empty.

Functions

func CopyBytes

func CopyBytes(b []byte) (copiedBytes []byte)

func Deserialize

func Deserialize(hash []byte, r io.Reader, needFlags bool) (node, error)

Types

type Database

type Database interface {
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	Compact() error
	NewBatch() error
	BatchPut(key, value []byte) error
	BatchDelete(key []byte) error
	BatchCommit() error
	NewIterator(prefix []byte) db.IIterator
}

type Iterator

type Iterator struct {
	Key   []byte
	Value []byte
	Err   error
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(it NodeIterator) *Iterator

func (*Iterator) Next

func (it *Iterator) Next() bool

type MemDatabase

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

func NewMemDatabase

func NewMemDatabase() *MemDatabase

func (*MemDatabase) BatchPut

func (db *MemDatabase) BatchPut(key []byte, value []byte) error

func (*MemDatabase) Delete

func (db *MemDatabase) Delete(key []byte) error

func (*MemDatabase) Get

func (db *MemDatabase) Get(key []byte) ([]byte, error)

func (*MemDatabase) Has

func (db *MemDatabase) Has(key []byte) (bool, error)

func (*MemDatabase) ViewDB

func (db *MemDatabase) ViewDB()

type NodeIterator

type NodeIterator interface {
	Next(bool) bool
	Error() error
	Hash() common.Uint256
	Parent() common.Uint256
	Path() []byte
	Leaf() bool
	LeafKey() []byte
	LeafBlob() []byte
}

type RefCounts

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

func NewRefCounts

func NewRefCounts(t *Trie, refCountTargetHeight, pruningTargetHeight uint32) (*RefCounts, error)

func (*RefCounts) Commit

func (ref *RefCounts) Commit() error

func (*RefCounts) Compact

func (ref *RefCounts) Compact() error

func (*RefCounts) CreateRefCounts

func (ref *RefCounts) CreateRefCounts(hash common.Uint256, inMemory bool) error

func (*RefCounts) LengthOfCounts

func (ref *RefCounts) LengthOfCounts() int

func (*RefCounts) NewBatch

func (ref *RefCounts) NewBatch() error

func (*RefCounts) PersistPrunedHeights

func (ref *RefCounts) PersistPrunedHeights() error

func (*RefCounts) PersistRefCountHeights

func (ref *RefCounts) PersistRefCountHeights() error

func (*RefCounts) PersistRefCounts

func (ref *RefCounts) PersistRefCounts() error

func (*RefCounts) Prune

func (ref *RefCounts) Prune(hash common.Uint256, inMemory bool) error

func (*RefCounts) RebuildRefCount

func (ref *RefCounts) RebuildRefCount() error

func (*RefCounts) SequentialPrune

func (ref *RefCounts) SequentialPrune() error

func (*RefCounts) Verify

func (ref *RefCounts) Verify(hash common.Uint256) error

type Trie

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

func New

func New(hash common.Uint256, db Database) (*Trie, error)

func (*Trie) Commit

func (t *Trie) Commit() (common.Uint256, error)

func (*Trie) CommitTo

func (t *Trie) CommitTo(db Database) (common.Uint256, error)

func (*Trie) Copy

func (t *Trie) Copy() *Trie

func (*Trie) Delete

func (t *Trie) Delete(key []byte)

func (*Trie) Get

func (t *Trie) Get(key []byte) []byte

func (*Trie) Hash

func (t *Trie) Hash() common.Uint256

func (*Trie) NewRefCounts

func (t *Trie) NewRefCounts(targetRefCountHeight, targetPruningHeight uint32) (*RefCounts, error)

func (*Trie) NodeIterator

func (t *Trie) NodeIterator(start []byte) NodeIterator

func (*Trie) TryDelete

func (t *Trie) TryDelete(key []byte) error

func (*Trie) TryGet

func (t *Trie) TryGet(key []byte) ([]byte, error)

func (*Trie) TryTraverse

func (t *Trie) TryTraverse() error

func (*Trie) TryUpdate

func (t *Trie) TryUpdate(key, value []byte) error

func (*Trie) Update

func (t *Trie) Update(key, value []byte)

Jump to

Keyboard shortcuts

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