Documentation ¶
Index ¶
- Constants
- func NewKVStoreService(storeKey string) store.KVStoreService
- func ProvideCometService() comet.Service
- func ProvideEnvironment(logger log.Logger, config *runtimev2.Module, key depinject.ModuleKey, ...) (appmodulev2.Environment, store.KVStoreService, store.MemoryStoreService)
- func ProvideGenesisTxHandler(appBuilder *AppBuilder) genesis.TxHandler
- func SetupAppBuilder(inputs AppInputs)
- type App
- func (a *App) Close() error
- func (a *App) DefaultGenesis() map[string]json.RawMessage
- func (a *App) ExecuteGenesisTx(_ []byte) error
- func (a *App) GetLogger() log.Logger
- func (a *App) GetStore() Store
- func (a *App) GetStoreKeys() []string
- func (a *App) LoadHeight(height uint64) error
- func (a *App) LoadLatest() error
- func (a *App) Logger() log.Logger
- func (a *App) ModuleManager() *MM
- func (a *App) UnsafeFindStoreKey(storeKey string) (string, error)
- type AppBuilder
- type AppBuilderOption
- func AppBuilderWithBranch(branch func(state store.ReaderMap) store.WriterMap) AppBuilderOption
- func AppBuilderWithPostTxExec(postTxExec func(ctx context.Context, tx transaction.Tx, success bool) error) AppBuilderOption
- func AppBuilderWithTxValidator(txValidators func(ctx context.Context, tx transaction.Tx) error) AppBuilderOption
- type AppI
- type AppInputs
- type MM
- func (m *MM) BeginBlock() func(ctx context.Context) error
- func (m *MM) DefaultGenesis() map[string]json.RawMessage
- func (m *MM) EndBlock() (endBlockFunc func(ctx context.Context) error, ...)
- func (m *MM) ExportGenesisForModules(ctx context.Context, modulesToExport ...string) (map[string]json.RawMessage, error)
- func (m *MM) InitGenesisJSON(ctx context.Context, genesisData map[string]json.RawMessage, ...) error
- func (m *MM) Modules() map[string]appmodulev2.AppModule
- func (m *MM) PreBlocker() func(ctx context.Context, txs []transaction.Tx) error
- func (m *MM) RegisterInterfaces(registry registry.InterfaceRegistrar)
- func (m *MM) RegisterLegacyAminoCodec(cdc legacy.Amino)
- func (m *MM) RegisterServices(app *App) error
- func (m *MM) RunMigrations(ctx context.Context, fromVM appmodulev2.VersionMap) (appmodulev2.VersionMap, error)
- func (m *MM) TxValidators() func(ctx context.Context, tx transaction.Tx) error
- func (m *MM) ValidateGenesis(genesisData map[string]json.RawMessage) error
- type Store
Constants ¶
const ModuleName = "runtime"
Variables ¶
This section is empty.
Functions ¶
func NewKVStoreService ¶
func NewKVStoreService(storeKey string) store.KVStoreService
NewKVStoreService creates a new KVStoreService. This wrapper is kept for backwards compatibility. When migrating from runtime to runtime/v2, use runtimev2.NewKVStoreService(storeKey.Name()) instead of runtime.NewKVStoreService(storeKey).
func ProvideEnvironment ¶
func ProvideEnvironment(logger log.Logger, config *runtimev2.Module, key depinject.ModuleKey, appBuilder *AppBuilder) ( appmodulev2.Environment, store.KVStoreService, store.MemoryStoreService, )
ProvideEnvironment provides the environment for keeper modules, while maintaining backward compatibility and provide services directly as well.
func ProvideGenesisTxHandler ¶
func ProvideGenesisTxHandler(appBuilder *AppBuilder) genesis.TxHandler
Types ¶
type App ¶
type App struct { *appmanager.AppManager[transaction.Tx] // contains filtered or unexported fields }
App is a wrapper around AppManager and ModuleManager that can be used in hybrid app.go/app config scenarios or directly as a servertypes.Application instance. To get an instance of *App, *AppBuilder must be requested as a dependency in a container which declares the runtime module and the AppBuilder.Build() method must be called.
App can be used to create a hybrid app.go setup where some configuration is done declaratively with an app config and the rest of it is done the old way. See simapp/app_v2.go for an example of this setup.
func (*App) Close ¶
Close is called in start cmd to gracefully cleanup resources.
func (*App) DefaultGenesis ¶
func (a *App) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered modules.
func (*App) GetStoreKeys ¶
GetStoreKeys returns all the app store keys.
func (*App) LoadHeight ¶
LoadHeight loads a particular height
func (*App) ModuleManager ¶
ModuleManager returns the module manager.
type AppBuilder ¶
type AppBuilder struct {
// contains filtered or unexported fields
}
AppBuilder is a type that is injected into a container by the runtime/v2 module (as *AppBuilder) which can be used to create an app which is compatible with the existing app.go initialization conventions.
func ProvideAppBuilder ¶
func ProvideAppBuilder( interfaceRegistrar registry.InterfaceRegistrar, amino legacy.Amino, ) ( *AppBuilder, *stf.MsgRouterBuilder, appmodulev2.AppModule, protodesc.Resolver, protoregistry.MessageTypeResolver, )
func (*AppBuilder) Build ¶
func (a *AppBuilder) Build(opts ...AppBuilderOption) (*App, error)
Build builds an *App instance.
func (*AppBuilder) DefaultGenesis ¶
func (a *AppBuilder) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered AppModule's.
func (*AppBuilder) RegisterModules ¶
func (a *AppBuilder) RegisterModules(modules ...appmodulev2.AppModule) error
RegisterModules registers the provided modules with the module manager. This is the primary hook for integrating with modules which are not registered using the app config.
func (*AppBuilder) RegisterStores ¶
func (a *AppBuilder) RegisterStores(keys ...string)
RegisterStores registers the provided store keys. This method should only be used for registering extra stores wiich is necessary for modules that not registered using the app config. To be used in combination of RegisterModules.
type AppBuilderOption ¶
type AppBuilderOption func(*AppBuilder)
AppBuilderOption is a function that can be passed to AppBuilder.Build to customize the resulting app.
func AppBuilderWithBranch ¶
func AppBuilderWithBranch(branch func(state store.ReaderMap) store.WriterMap) AppBuilderOption
AppBuilderWithBranch sets a custom branch implementation for the app.
func AppBuilderWithPostTxExec ¶
func AppBuilderWithPostTxExec( postTxExec func( ctx context.Context, tx transaction.Tx, success bool, ) error, ) AppBuilderOption
AppBuilderWithPostTxExec sets logic that will be executed after each transaction. When not provided, a no-op function will be used.
func AppBuilderWithTxValidator ¶
func AppBuilderWithTxValidator(txValidators func(ctx context.Context, tx transaction.Tx) error) AppBuilderOption
AppBuilderWithTxValidator sets the tx validator for the app. It overrides all default tx validators defined by modules.
type AppI ¶
type AppI[T transaction.Tx] interface { DeliverBlock( ctx context.Context, block *coreappmanager.BlockRequest[T], ) (*coreappmanager.BlockResponse, store.WriterMap, error) ValidateTx(ctx context.Context, tx T) (coreappmanager.TxResult, error) Simulate(ctx context.Context, tx T) (coreappmanager.TxResult, store.WriterMap, error) Query(ctx context.Context, version uint64, request transaction.Msg) (transaction.Msg, error) QueryWithState(ctx context.Context, state store.ReaderMap, request transaction.Msg) (transaction.Msg, error) Logger() log.Logger ModuleManager() *MM Close() error }
AppI is an interface that defines the methods required by the App.
type AppInputs ¶
type AppInputs struct { depinject.In AppConfig *appv1alpha1.Config Config *runtimev2.Module AppBuilder *AppBuilder ModuleManager *MM InterfaceRegistrar registry.InterfaceRegistrar LegacyAmino legacy.Amino Logger log.Logger StoreOptions *rootstorev2.FactoryOptions `optional:"true"` }
type MM ¶
type MM struct {
// contains filtered or unexported fields
}
func NewModuleManager ¶
func NewModuleManager( logger log.Logger, config *runtimev2.Module, modules map[string]appmodulev2.AppModule, ) *MM
NewModuleManager is the constructor for the module manager It handles all the interactions between the modules and the application
func ProvideModuleManager ¶
func (*MM) BeginBlock ¶
BeginBlock runs the begin-block logic of all modules
func (*MM) DefaultGenesis ¶
func (m *MM) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis provides default genesis information for all modules
func (*MM) EndBlock ¶
func (m *MM) EndBlock() (endBlockFunc func(ctx context.Context) error, valUpdateFunc func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error))
EndBlock runs the end-block logic of all modules and tx validator updates
func (*MM) ExportGenesisForModules ¶
func (m *MM) ExportGenesisForModules( ctx context.Context, modulesToExport ...string, ) (map[string]json.RawMessage, error)
ExportGenesisForModules performs export genesis functionality for modules
func (*MM) InitGenesisJSON ¶
func (m *MM) InitGenesisJSON( ctx context.Context, genesisData map[string]json.RawMessage, txHandler func(json.RawMessage) error, ) error
InitGenesisJSON performs init genesis functionality for modules from genesis data in JSON format
func (*MM) Modules ¶
func (m *MM) Modules() map[string]appmodulev2.AppModule
Modules returns the modules registered in the module manager
func (*MM) PreBlocker ¶
PreBlocker runs the pre-block logic of all modules
func (*MM) RegisterInterfaces ¶
func (m *MM) RegisterInterfaces(registry registry.InterfaceRegistrar)
RegisterInterfaces registers all module interface types
func (*MM) RegisterLegacyAminoCodec ¶
RegisterLegacyAminoCodec registers all module codecs
func (*MM) RegisterServices ¶
RegisterServices registers all module services.
func (*MM) RunMigrations ¶
func (m *MM) RunMigrations(ctx context.Context, fromVM appmodulev2.VersionMap) (appmodulev2.VersionMap, error)
TODO write as descriptive godoc as module manager v1. TODO include feedback from https://github.com/cosmos/cosmos-sdk/issues/15120
func (*MM) TxValidators ¶
TxValidators validates incoming transactions
type Store ¶
type Store interface { // GetLatestVersion returns the latest version that consensus has been made on GetLatestVersion() (uint64, error) // StateLatest returns a readonly view over the latest // committed state of the store. Alongside the version // associated with it. StateLatest() (uint64, store.ReaderMap, error) // StateAt returns a readonly view over the provided // state. Must error when the version does not exist. StateAt(version uint64) (store.ReaderMap, error) Commit(changeset *store.Changeset) (store.Hash, error) // Query is a key/value query directly to the underlying database. This skips the appmanager Query(storeKey []byte, version uint64, key []byte, prove bool) (storev2.QueryResult, error) // GetStateStorage returns the SS backend. GetStateStorage() storev2.VersionedDatabase // GetStateCommitment returns the SC backend. GetStateCommitment() storev2.Committer // LoadVersion loads the RootStore to the given version. LoadVersion(version uint64) error // LoadLatestVersion behaves identically to LoadVersion except it loads the // latest version implicitly. LoadLatestVersion() error LastCommitID() (proof.CommitID, error) }