Documentation ¶
Index ¶
- func NewVersionedIBCModule(wrappedModule, nextModule porttypes.IBCModule, fromVersion, toVersion uint64) porttypes.IBCModule
- type Configurator
- func (c Configurator) GetAcceptedMessages() map[uint64]map[string]struct{}
- func (c Configurator) MsgServer() pbgrpc.Server
- func (c Configurator) QueryServer() pbgrpc.Server
- func (c Configurator) RegisterMigration(moduleName string, fromVersion uint64, handler module.MigrationHandler) error
- func (c *Configurator) WithVersions(fromVersion, toVersion uint64) module.Configurator
- type Manager
- func (m *Manager) AssertMatchingModules(basicModuleManager sdkmodule.BasicManager) error
- func (m *Manager) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (m *Manager) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (m *Manager) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec, version uint64) map[string]json.RawMessage
- func (m *Manager) GetVersionMap(version uint64) sdkmodule.VersionMap
- func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData map[string]json.RawMessage, ...) abci.ResponseInitChain
- func (m *Manager) ModuleNames(version uint64) []string
- func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry)
- func (m *Manager) RegisterServices(cfg Configurator)
- func (m Manager) RunMigrations(ctx sdk.Context, cfg sdkmodule.Configurator, fromVersion, toVersion uint64) error
- func (m *Manager) SetOrderBeginBlockers(moduleNames ...string)
- func (m *Manager) SetOrderEndBlockers(moduleNames ...string)
- func (m *Manager) SetOrderExportGenesis(moduleNames ...string)
- func (m *Manager) SetOrderInitGenesis(moduleNames ...string)
- func (m *Manager) SetOrderMigrations(moduleNames ...string)
- func (m *Manager) SupportedVersions() []uint64
- type MigrationHandler
- type VersionedIBCModule
- func (v *VersionedIBCModule) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, ...) error
- func (v *VersionedIBCModule) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error
- func (v *VersionedIBCModule) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error
- func (v *VersionedIBCModule) OnChanOpenAck(ctx sdk.Context, portID, channelID string, counterpartyChannelID string, ...) error
- func (v *VersionedIBCModule) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error
- func (v *VersionedIBCModule) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, ...) (string, error)
- func (v *VersionedIBCModule) OnChanOpenTry(ctx sdk.Context, order channeltypes.Order, connectionHops []string, ...) (version string, err error)
- func (v *VersionedIBCModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement
- func (v *VersionedIBCModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error
- type VersionedModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configurator ¶
type Configurator struct {
// contains filtered or unexported fields
}
Configurator is a struct used at startup to register all the message and query servers for all modules. It allows the module to register any migrations from one consensus version of the module to the next. Finally it maps all the messages to the app versions that they are accepted in. This then gets used in the antehandler to prevent users from submitting messages that can not yet be executed.
func NewConfigurator ¶
func NewConfigurator(cdc codec.Codec, msgServer, queryServer pbgrpc.Server) Configurator
NewConfigurator returns a new Configurator instance.
func (Configurator) GetAcceptedMessages ¶
func (c Configurator) GetAcceptedMessages() map[uint64]map[string]struct{}
GetAcceptedMessages returns the accepted messages for all versions. acceptedMessages is a map from appVersion -> msgTypeURL -> struct{}.
func (Configurator) MsgServer ¶
func (c Configurator) MsgServer() pbgrpc.Server
MsgServer implements the Configurator.MsgServer method.
func (Configurator) QueryServer ¶
func (c Configurator) QueryServer() pbgrpc.Server
QueryServer implements the Configurator.QueryServer method.
func (Configurator) RegisterMigration ¶
func (c Configurator) RegisterMigration(moduleName string, fromVersion uint64, handler module.MigrationHandler) error
RegisterMigration implements the Configurator.RegisterMigration method.
func (*Configurator) WithVersions ¶
func (c *Configurator) WithVersions(fromVersion, toVersion uint64) module.Configurator
type Manager ¶
type Manager struct { OrderInitGenesis []string OrderExportGenesis []string OrderBeginBlockers []string OrderEndBlockers []string OrderMigrations []string // contains filtered or unexported fields }
Manager defines a module manager that provides the high level utility for managing and executing operations for a group of modules. This implementation was originally inspired by the module manager defined in Cosmos SDK but this implemention maps the state machine version to different versions of the module. It also provides a way to run migrations between different versions of a module.
func NewManager ¶
func NewManager(modules []VersionedModule) (*Manager, error)
NewManager returns a new Manager object.
func (*Manager) AssertMatchingModules ¶
func (m *Manager) AssertMatchingModules(basicModuleManager sdkmodule.BasicManager) error
assertMatchingModules performs a sanity check that the basic module manager contains all the same modules present in the module manager
func (*Manager) BeginBlock ¶
func (m *Manager) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlock performs begin block functionality for all modules. It creates a child context with an event manager to aggregate events emitted from all modules.
func (*Manager) EndBlock ¶
func (m *Manager) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlock performs end block functionality for all modules. It creates a child context with an event manager to aggregate events emitted from all modules.
func (*Manager) ExportGenesis ¶
func (m *Manager) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec, version uint64) map[string]json.RawMessage
ExportGenesis performs export genesis functionality for the modules supported in a particular version.
func (*Manager) GetVersionMap ¶
func (m *Manager) GetVersionMap(version uint64) sdkmodule.VersionMap
GetVersionMap gets consensus version from all modules
func (*Manager) InitGenesis ¶
func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData map[string]json.RawMessage, appVersion uint64) abci.ResponseInitChain
InitGenesis performs init genesis functionality for modules. Exactly one module must return a non-empty validator set update to correctly initialize the chain.
func (*Manager) ModuleNames ¶
ModuleNames returns the list of module names that are supported for a particular version in no particular order.
func (*Manager) RegisterInvariants ¶
func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry)
RegisterInvariants registers all module invariants.
func (*Manager) RegisterServices ¶
func (m *Manager) RegisterServices(cfg Configurator)
RegisterServices registers all module services.
func (Manager) RunMigrations ¶
func (m Manager) RunMigrations(ctx sdk.Context, cfg sdkmodule.Configurator, fromVersion, toVersion uint64) error
RunMigrations performs in-place store migrations for all modules. This function MUST be called when the state machine changes appVersion
func (*Manager) SetOrderBeginBlockers ¶
SetOrderBeginBlockers sets the order of begin-blocker calls.
func (*Manager) SetOrderEndBlockers ¶
SetOrderEndBlockers sets the order of end-blocker calls.
func (*Manager) SetOrderExportGenesis ¶
SetOrderExportGenesis sets the order of export genesis calls.
func (*Manager) SetOrderInitGenesis ¶
SetOrderInitGenesis sets the order of init genesis calls.
func (*Manager) SetOrderMigrations ¶
SetOrderMigrations sets the order of migrations to be run. If not set then migrations will be run with an order defined in `defaultMigrationsOrder`.
func (*Manager) SupportedVersions ¶
SupportedVersions returns all the supported versions for the module manager
type MigrationHandler ¶
MigrationHandler is the migration function that each module registers.
type VersionedIBCModule ¶
type VersionedIBCModule struct {
// contains filtered or unexported fields
}
func (*VersionedIBCModule) OnAcknowledgementPacket ¶
func (v *VersionedIBCModule) OnAcknowledgementPacket( ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, ) error
func (*VersionedIBCModule) OnChanCloseConfirm ¶
func (v *VersionedIBCModule) OnChanCloseConfirm( ctx sdk.Context, portID, channelID string, ) error
func (*VersionedIBCModule) OnChanCloseInit ¶
func (v *VersionedIBCModule) OnChanCloseInit( ctx sdk.Context, portID, channelID string, ) error
func (*VersionedIBCModule) OnChanOpenAck ¶
func (*VersionedIBCModule) OnChanOpenConfirm ¶
func (v *VersionedIBCModule) OnChanOpenConfirm( ctx sdk.Context, portID, channelID string, ) error
func (*VersionedIBCModule) OnChanOpenInit ¶
func (v *VersionedIBCModule) OnChanOpenInit( ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error)
func (*VersionedIBCModule) OnChanOpenTry ¶
func (v *VersionedIBCModule) OnChanOpenTry( ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error)
func (*VersionedIBCModule) OnRecvPacket ¶
func (v *VersionedIBCModule) OnRecvPacket( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement
func (*VersionedIBCModule) OnTimeoutPacket ¶
func (v *VersionedIBCModule) OnTimeoutPacket( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, ) error
type VersionedModule ¶
type VersionedModule struct { Module sdkmodule.AppModule // FromVersion and ToVersion indicate the continuous range of app versions // that this particular module is part of. The range is inclusive. // FromVersion should not be smaller than ToVersion. 0 is not a valid app // version. FromVersion, ToVersion uint64 }