tree

package
v1.1.8-pre-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 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
}

func (*ImmutableTree) Get

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

func (*ImmutableTree) Hash

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

func (*ImmutableTree) Iterate

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

func (*ImmutableTree) Version

func (t *ImmutableTree) Version() int64

type MTree added in v1.2.0

type MTree interface {
	ReadOnlyTree
	KeepLastHeight() int64
	AvailableVersions() []int
	Set(key, value []byte) bool
	Remove(key []byte) ([]byte, bool)
	LoadVersion(targetVersion int64) (int64, error)
	LazyLoadVersion(targetVersion int64) (int64, error)
	SaveVersion() ([]byte, int64, error)
	DeleteVersionsIfExists(from, to int64) error
	DeleteVersionIfExists(version int64) error
	GetImmutable() *ImmutableTree
	GetImmutableAtHeight(version int64) (*ImmutableTree, error)
	GlobalLock()
	GlobalUnlock()
}

func NewImmutableTree

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

Warning: returns the MTree interface, but you should only use ReadOnlyTree

func NewMutableTree

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

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)
}

Jump to

Keyboard shortcuts

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