tree

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImmutableTree

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

ImmutableTree used for CheckState: API and CheckTx calls.

func (*ImmutableTree) Get

func (t *ImmutableTree) Get(key []byte) (index int64, value []byte)

Get returns the index and value of the specified key if it exists, or nil and the next index otherwise. The returned value must not be modified, since it may point to data stored within IAVL.

func (*ImmutableTree) Hash

func (t *ImmutableTree) Hash() []byte

Hash returns the root hash.

func (*ImmutableTree) Iterate

func (t *ImmutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)

Iterate iterates over all keys of the tree, in order. The keys and values must not be modified, since they may point to data stored within IAVL.

func (*ImmutableTree) Version

func (t *ImmutableTree) Version() int64

Version returns the version of the tree.

type MTree added in v1.2.0

type MTree interface {
	ReadOnlyTree
	Set(key, value []byte) bool
	Remove(key []byte) ([]byte, bool)
	LoadVersion(targetVersion int64) (int64, error)
	LazyLoadVersion(targetVersion int64) (int64, error)
	SaveVersion() ([]byte, int64, error)
	DeleteVersionIfExists(version int64) error
	DeleteVersionsRange(fromVersion, toVersion int64) error
	GetImmutable() *ImmutableTree
	GetImmutableAtHeight(version int64) (*ImmutableTree, error)
	GlobalLock()
	GlobalUnlock()
}

MTree mutable tree, used for txs delivery

func NewImmutableTree

func NewImmutableTree(height uint64, db dbm.DB) (MTree, error)

NewImmutableTree returns MTree from given db at given height Warning: returns the MTree interface, but you should only use ReadOnlyTree

func NewMutableTree

func NewMutableTree(height uint64, db dbm.DB, cacheSize int) (MTree, error)

NewMutableTree creates and returns new MutableTree using given db. Panics on error. If you want to get read-only state, you should use height = 0 and LazyLoadVersion (version), see NewImmutableTree

type ReadOnlyTree added in v1.2.0

type ReadOnlyTree interface {
	Get(key []byte) (index int64, value []byte)
	Version() int64
	Hash() []byte
	Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
	AvailableVersions() []int
}

ReadOnlyTree used for CheckState: API and CheckTx calls. Immutable.

Jump to

Keyboard shortcuts

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