iavl

package
v2.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CacheSize              int  `mapstructure:"cache-size" toml:"cache-size" comment:"CacheSize set the size of the iavl tree cache."`
	SkipFastStorageUpgrade bool `` /* 169-byte string literal not displayed */
}

Config is the configuration for the IAVL tree.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for the IAVL tree.

type Exporter

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

Exporter is a wrapper around iavl.Exporter.

func (*Exporter) Close

func (e *Exporter) Close() error

Close closes the exporter.

func (*Exporter) Next

Next returns the next item in the exporter.

type IavlTree

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

IavlTree is a wrapper around iavl.MutableTree.

func NewIavlTree

func NewIavlTree(db corestore.KVStoreWithBatch, logger log.Logger, cfg *Config) *IavlTree

NewIavlTree creates a new IavlTree instance.

func (*IavlTree) Close

func (t *IavlTree) Close() error

Close closes the iavl tree.

func (*IavlTree) Commit

func (t *IavlTree) Commit() ([]byte, uint64, error)

Commit commits the current state to the tree.

func (*IavlTree) Export

func (t *IavlTree) Export(version uint64) (commitment.Exporter, error)

Export exports the tree exporter at the given version.

func (*IavlTree) Get

func (t *IavlTree) Get(version uint64, key []byte) ([]byte, error)

Get implements the Reader interface.

func (*IavlTree) GetLatestVersion

func (t *IavlTree) GetLatestVersion() (uint64, error)

GetLatestVersion returns the latest version of the tree.

func (*IavlTree) GetProof

func (t *IavlTree) GetProof(version uint64, key []byte) (*ics23.CommitmentProof, error)

GetProof returns a proof for the given key and version.

func (*IavlTree) Hash

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

Hash returns the hash of the latest saved version of the tree.

func (*IavlTree) Import

func (t *IavlTree) Import(version uint64) (commitment.Importer, error)

Import imports the tree importer at the given version.

func (*IavlTree) Iterator

func (t *IavlTree) Iterator(version uint64, start, end []byte, ascending bool) (corestore.Iterator, error)

Iterator implements the Reader interface.

func (*IavlTree) LoadVersion

func (t *IavlTree) LoadVersion(version uint64) error

LoadVersion loads the state at the given version.

func (*IavlTree) LoadVersionForOverwriting

func (t *IavlTree) LoadVersionForOverwriting(version uint64) error

LoadVersionForOverwriting loads the state at the given version. Any versions greater than targetVersion will be deleted.

func (*IavlTree) PausePruning

func (t *IavlTree) PausePruning(pause bool)

PausePruning pauses the pruning process.

func (*IavlTree) Prune

func (t *IavlTree) Prune(version uint64) error

Prune prunes all versions up to and including the provided version.

func (*IavlTree) Remove

func (t *IavlTree) Remove(key []byte) error

Remove removes the given key from the tree.

func (*IavlTree) Set

func (t *IavlTree) Set(key, value []byte) error

Set sets the given key-value pair in the tree.

func (*IavlTree) SetInitialVersion

func (t *IavlTree) SetInitialVersion(version uint64) error

SetInitialVersion sets the initial version of the database.

func (*IavlTree) Version

func (t *IavlTree) Version() uint64

Version returns the current version of the tree.

func (*IavlTree) WorkingHash

func (t *IavlTree) WorkingHash() []byte

WorkingHash returns the working hash of the tree. Danger! iavl.MutableTree.WorkingHash() is a mutating operation! It advances the tree version by 1.

type Importer

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

Importer is a wrapper around iavl.Importer.

func (*Importer) Add

Add adds the given item to the importer.

func (*Importer) Close

func (i *Importer) Close() error

Close closes the importer.

func (*Importer) Commit

func (i *Importer) Commit() error

Commit commits the importer.

Jump to

Keyboard shortcuts

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