cosmos-sdk: github.com/cosmos/cosmos-sdk/store/iavl Index | Files

package iavl

import "github.com/cosmos/cosmos-sdk/store/iavl"

Index

Package Files

store.go tree.go wire.go

func LoadStore Uses

func LoadStore(db dbm.DB, id types.CommitID, pruning types.PruningOptions, lazyLoading bool) (types.CommitKVStore, error)

LoadStore returns an IAVL Store as a CommitKVStore. Internally, it will load the store's version (id) from the provided DB. An error is returned if the version fails to load.

type Store Uses

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

Store Implements types.KVStore and CommitKVStore.

func UnsafeNewStore Uses

func UnsafeNewStore(tree *iavl.MutableTree, po types.PruningOptions) *Store

UnsafeNewStore returns a reference to a new IAVL Store with a given mutable IAVL tree reference. It should only be used for testing purposes.

CONTRACT: The IAVL tree should be fully loaded. CONTRACT: PruningOptions passed in as argument must be the same as pruning options passed into iavl.MutableTree

func (*Store) CacheWrap Uses

func (st *Store) CacheWrap() types.CacheWrap

Implements Store.

func (*Store) CacheWrapWithTrace Uses

func (st *Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap

CacheWrapWithTrace implements the Store interface.

func (*Store) Commit Uses

func (st *Store) Commit() types.CommitID

Commit commits the current store state and returns a CommitID with the new version and hash.

func (*Store) Delete Uses

func (st *Store) Delete(key []byte)

Implements types.KVStore.

func (*Store) Get Uses

func (st *Store) Get(key []byte) []byte

Implements types.KVStore.

func (*Store) GetImmutable Uses

func (st *Store) GetImmutable(version int64) (*Store, error)

GetImmutable returns a reference to a new store backed by an immutable IAVL tree at a specific version (height) without any pruning options. This should be used for querying and iteration only. If the version does not exist or has been pruned, an error will be returned. Any mutable operations executed will result in a panic.

func (*Store) GetStoreType Uses

func (st *Store) GetStoreType() types.StoreType

Implements Store.

func (*Store) Has Uses

func (st *Store) Has(key []byte) (exists bool)

Implements types.KVStore.

func (*Store) Iterator Uses

func (st *Store) Iterator(start, end []byte) types.Iterator

Implements types.KVStore.

func (*Store) LastCommitID Uses

func (st *Store) LastCommitID() types.CommitID

Implements Committer.

func (*Store) Query Uses

func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery)

Query implements ABCI interface, allows queries

by default we will return from (latest height -1), as we will have merkle proofs immediately (header height = data height + 1) If latest-1 is not present, use latest (which must be present) if you care to have the latest data to see a tx results, you must explicitly set the height you want to see

func (*Store) ReverseIterator Uses

func (st *Store) ReverseIterator(start, end []byte) types.Iterator

Implements types.KVStore.

func (*Store) Set Uses

func (st *Store) Set(key, value []byte)

Implements types.KVStore.

func (*Store) SetPruning Uses

func (st *Store) SetPruning(_ types.PruningOptions)

SetPruning panics as pruning options should be provided at initialization since IAVl accepts pruning options directly.

func (*Store) VersionExists Uses

func (st *Store) VersionExists(version int64) bool

VersionExists returns whether or not a given version is stored.

type Tree Uses

type Tree interface {
    Has(key []byte) bool
    Get(key []byte) (index int64, value []byte)
    Set(key, value []byte) bool
    Remove(key []byte) ([]byte, bool)
    SaveVersion() ([]byte, int64, error)
    DeleteVersion(version int64) error
    Version() int64
    Hash() []byte
    VersionExists(version int64) bool
    GetVersioned(key []byte, version int64) (int64, []byte)
    GetVersionedWithProof(key []byte, version int64) ([]byte, *iavl.RangeProof, error)
    GetImmutable(version int64) (*iavl.ImmutableTree, error)
}

Tree defines an interface that both mutable and immutable IAVL trees must implement. For mutable IAVL trees, the interface is directly implemented by an iavl.MutableTree. For an immutable IAVL tree, a wrapper must be made.

Package iavl imports 15 packages (graph) and is imported by 3 packages. Updated 2020-03-29. Refresh now. Tools for package owners.