Documentation ¶
Index ¶
- Constants
- func CreateRootStore(opts *FactoryOptions) (store.RootStore, error)
- func New(logger log.Logger, ss store.VersionedDatabase, sc store.Committer, ...) (store.RootStore, error)
- type FactoryOptions
- type Reader
- type ReaderMap
- type SCType
- type SSType
- type Store
- func (s *Store) Close() (err error)
- func (s *Store) Commit(cs *corestore.Changeset) ([]byte, error)
- func (s *Store) GetLatestVersion() (uint64, error)
- func (s *Store) GetStateCommitment() store.Committer
- func (s *Store) GetStateStorage() store.VersionedDatabase
- func (s *Store) LastCommitID() (proof.CommitID, error)
- func (s *Store) LoadLatestVersion() error
- func (s *Store) LoadVersion(version uint64) error
- func (s *Store) Query(storeKey []byte, version uint64, key []byte, prove bool) (store.QueryResult, error)
- func (s *Store) SetCommitHeader(h *coreheader.Info)
- func (s *Store) SetInitialVersion(v uint64) error
- func (s *Store) SetMetrics(m metrics.Metrics)
- func (s *Store) StateAt(v uint64) (corestore.ReaderMap, error)
- func (s *Store) StateLatest() (uint64, corestore.ReaderMap, error)
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func CreateRootStore ¶
func CreateRootStore(opts *FactoryOptions) (store.RootStore, error)
CreateRootStore is a convenience function to create a root store based on the provided FactoryOptions. Strictly speaking app developers can create the root store directly by calling root.New, so this function is not necessary, but demonstrates the required steps and configuration to create a root store.
func New ¶
func New( logger log.Logger, ss store.VersionedDatabase, sc store.Committer, pm *pruning.Manager, mm *migration.Manager, m metrics.StoreMetrics, ) (store.RootStore, error)
New creates a new root Store instance.
NOTE: The migration manager is optional and can be nil if no migration is required.
Types ¶
type FactoryOptions ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader represents a read-only adapter for accessing data from the root store.
func (*Reader) Iterator ¶
type ReaderMap ¶
type ReaderMap struct {
// contains filtered or unexported fields
}
ReaderMap defines an adapter around a RootStore that only exposes read-only operations. This is useful for exposing a read-only view of the RootStore at a specific version in history, which could also be the latest state.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store defines the SDK's default RootStore implementation. It contains a single State Storage (SS) backend and a single State Commitment (SC) backend. The SC backend may or may not support multiple store keys and is implementation dependent.
func (*Store) Close ¶
Close closes the store and resets all internal fields. Note, Close() is NOT idempotent and should only be called once.
func (*Store) Commit ¶
Commit commits all state changes to the underlying SS and SC backends. It writes a batch of the changeset to the SC tree, and retrieves the CommitInfo from the SC tree. Finally, it commits the SC tree and returns the hash of the CommitInfo.
func (*Store) GetLatestVersion ¶
GetLatestVersion returns the latest version based on the latest internal CommitInfo. An error is returned if the latest CommitInfo or version cannot be retrieved.
func (*Store) LastCommitID ¶
LastCommitID returns a CommitID based off of the latest internal CommitInfo. If an internal CommitInfo is not set, a new one will be returned with only the latest version set, which is based off of the SC view.
func (*Store) Query ¶
func (*Store) SetCommitHeader ¶
func (s *Store) SetCommitHeader(h *coreheader.Info)