Documentation ¶
Index ¶
- Variables
- func DefaultProofRuntime() (prt *merkle.ProofRuntime)
- func ErrStoreNotFound(skey string) error
- type Store
- func (tlm Store) AddListeners(skey types.StoreKey, listeners []types.WriteListener)
- func (rs *Store) CacheMultiStore() types.CacheMultiStore
- func (s *Store) Close() error
- func (s *Store) Commit() types.CommitID
- func (rs *Store) GetKVStore(skey types.StoreKey) types.KVStore
- func (s *Store) GetPruning() pruningtypes.PruningOptions
- func (rs *Store) GetVersion(version int64) (types.BasicMultiStore, error)
- func (s *Store) LastCommitID() types.CommitID
- func (tlm Store) ListeningEnabled(key types.StoreKey) bool
- func (rs *Store) PruneSnapshotHeight(height int64)
- func (rs *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery)
- func (rs *Store) Restore(height uint64, format uint32, protoReader protoio.Reader) (snapshottypes.SnapshotItem, error)
- func (rs *Store) SetInitialVersion(version uint64) error
- func (s *Store) SetPruning(po pruningtypes.PruningOptions)
- func (rs *Store) SetSnapshotInterval(snapshotInterval uint64)
- func (tlm Store) SetTraceContext(tc types.TraceContext)
- func (tlm Store) SetTracer(w io.Writer)
- func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error
- func (tlm Store) TracingEnabled() bool
- type StoreConfig
- func (tlm StoreConfig) AddListeners(skey types.StoreKey, listeners []types.WriteListener)
- func (tlm StoreConfig) ListeningEnabled(key types.StoreKey) bool
- func (pr *StoreConfig) RegisterSubstore(key string, typ types.StoreType) error
- func (tlm StoreConfig) SetTraceContext(tc types.TraceContext)
- func (tlm StoreConfig) SetTracer(w io.Writer)
- func (tlm StoreConfig) TracingEnabled() bool
- type StoreSchema
Constants ¶
This section is empty.
Variables ¶
var ( ErrVersionDoesNotExist = errors.New("version does not exist") ErrMaximumHeight = errors.New("maximum block height reached") )
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 ¶
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) GetKVStore ¶
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 ¶
LastCommitID implements Committer.
func (Store) ListeningEnabled ¶
ListeningEnabled returns if listening is enabled for a specific KVStore
func (*Store) PruneSnapshotHeight ¶
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 ¶
SetInitialVersion implements CommitMultiStore.
func (*Store) SetPruning ¶
func (s *Store) SetPruning(po pruningtypes.PruningOptions)
func (*Store) SetSnapshotInterval ¶
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) 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 ¶
ListeningEnabled returns if listening is enabled for a specific KVStore
func (*StoreConfig) RegisterSubstore ¶
func (StoreConfig) SetTraceContext ¶
func (tlm StoreConfig) SetTraceContext(tc types.TraceContext)
func (StoreConfig) TracingEnabled ¶
func (tlm StoreConfig) TracingEnabled() bool
type StoreSchema ¶
StoreSchema defineds a mapping of substore keys to store types