multi

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVersionDoesNotExist = errors.New("version does not exist")
	ErrMaximumHeight       = errors.New("maximum block height reached")
)
View Source
var ErrReadOnly = errors.New("cannot modify read-only store")

Functions

func DefaultProofRuntime

func DefaultProofRuntime() (prt *merkle.ProofRuntime)

DefaultProofRuntime returns a ProofRuntime supporting SMT and simple merkle proofs.

func ErrStoreNotFound

func ErrStoreNotFound(skey string) error

Types

type Store

type Store struct {
	StateCommitmentDB dbm.DBConnection

	// Copied from StoreConfig
	Pruning        pruningtypes.PruningOptions
	InitialVersion uint64 // if

	PersistentCache types.MultiStorePersistentCache
	// contains filtered or unexported fields
}

Store is the main persistent store type implementing CommitMultiStore. Substores consist of an SMT-based state commitment store and state storage. Substores must be reserved in the StoreConfig or defined as part of a StoreUpgrade in order to be valid. Note: The state commitment data and proof are structured in the same basic pattern as the MultiStore, but use an SMT rather than IAVL tree: * The state commitment store of each substore consists of a independent SMT. * The state commitment of the root store consists of a Merkle map of all registered persistent substore names to the root hash of their corresponding SMTs

func MigrateFromV1

func MigrateFromV1(rootMultiStore *v1Store.Store, store2db dbm.DBConnection, storeConfig StoreConfig) (*Store, error)

MigrateFromV1 will migrate the state from iavl to smt

func NewStore

func NewStore(db dbm.DBConnection, opts StoreConfig) (ret *Store, err error)

NewStore constructs a MultiStore directly from a database. Creates a new store if no data exists; otherwise loads existing data.

func (Store) AddListeners

func (tlm Store) AddListeners(skey types.StoreKey, listeners []types.WriteListener)

func (*Store) CacheMultiStore

func (rs *Store) CacheMultiStore() types.CacheMultiStore

CacheMultiStore implements BasicMultiStore.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Commit

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

Commit implements Committer.

func (*Store) GetKVStore

func (rs *Store) GetKVStore(skey types.StoreKey) types.KVStore

GetKVStore implements BasicMultiStore.

func (*Store) GetPruning

func (s *Store) GetPruning() pruningtypes.PruningOptions

func (*Store) GetVersion

func (rs *Store) GetVersion(version int64) (types.BasicMultiStore, error)

GetVersion implements CommitMultiStore.

func (*Store) LastCommitID

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

LastCommitID implements Committer.

func (Store) ListeningEnabled

func (tlm Store) ListeningEnabled(key types.StoreKey) bool

ListeningEnabled returns if listening is enabled for a specific KVStore

func (*Store) PruneSnapshotHeight

func (rs *Store) PruneSnapshotHeight(height int64)

PruneSnapshotHeight prunes the given height according to the prune strategy. If PruneNothing, this is a no-op. If other strategy, this height is persisted until it is less than <current height> - KeepRecent and <current height> % Interval == 0

func (*Store) Query

func (rs *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) Restore

func (rs *Store) Restore(
	height uint64, format uint32, protoReader protoio.Reader,
) (snapshottypes.SnapshotItem, error)

Restore implements snapshottypes.Snapshotter.

func (*Store) SetInitialVersion

func (rs *Store) SetInitialVersion(version uint64) error

SetInitialVersion implements CommitMultiStore.

func (*Store) SetPruning

func (s *Store) SetPruning(po pruningtypes.PruningOptions)

func (*Store) SetSnapshotInterval

func (rs *Store) SetSnapshotInterval(snapshotInterval uint64)

SetSnapshotInterval sets the interval at which the snapshots are taken. It is used by the store to determine which heights to retain until after the snapshot is complete.

func (Store) SetTraceContext

func (tlm Store) SetTraceContext(tc types.TraceContext)

func (Store) SetTracer

func (tlm Store) SetTracer(w io.Writer)

func (*Store) Snapshot

func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error

Snapshot implements snapshottypes.Snapshotter.

func (Store) TracingEnabled

func (tlm Store) TracingEnabled() bool

type StoreConfig

type StoreConfig struct {
	// Version pruning options for backing DBs.
	Pruning pruningtypes.PruningOptions
	// The minimum allowed version number.
	InitialVersion uint64
	// The backing DB to use for the state commitment Merkle tree data.
	// If nil, Merkle data is stored in the state storage DB under a separate prefix.
	StateCommitmentDB dbm.DBConnection

	PersistentCache types.MultiStorePersistentCache
	Upgrades        []types.StoreUpgrades
	// contains filtered or unexported fields
}

StoreConfig is used to define a schema and other options and pass them to the MultiStore constructor.

func DefaultStoreConfig

func DefaultStoreConfig() StoreConfig

DefaultStoreConfig returns a MultiStore config with an empty schema, a single backing DB, pruning with PruneDefault, no listeners and no tracer.

func (StoreConfig) AddListeners

func (tlm StoreConfig) AddListeners(skey types.StoreKey, listeners []types.WriteListener)

func (StoreConfig) ListeningEnabled

func (tlm StoreConfig) ListeningEnabled(key types.StoreKey) bool

ListeningEnabled returns if listening is enabled for a specific KVStore

func (*StoreConfig) RegisterSubstore

func (pr *StoreConfig) RegisterSubstore(key string, typ types.StoreType) error

func (StoreConfig) SetTraceContext

func (tlm StoreConfig) SetTraceContext(tc types.TraceContext)

func (StoreConfig) SetTracer

func (tlm StoreConfig) SetTracer(w io.Writer)

func (StoreConfig) TracingEnabled

func (tlm StoreConfig) TracingEnabled() bool

type StoreSchema

type StoreSchema map[string]types.StoreType

StoreSchema defineds a mapping of substore keys to store types

Jump to

Keyboard shortcuts

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