appmodule

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 1,163

Documentation

Overview

Package appmodule defines what is needed for an module to be used in the Cosmos SDK (runtime). It is equivalent to the appmodulev2 package, but less flexible to stay compatible with baseapp instead of server/v2. If you are looking at integrating dependency injection into your module please see depinject appconfig documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppModule added in v0.3.1

type AppModule = appmodulev2.AppModule

AppModule is a tag interface for app module implementations to use as a basis for extension interfaces. It provides no functionality itself, but is the type that all valid app modules should provide so that they can be identified by other modules (usually via depinject) as app modules.

type Environment added in v1.0.0

type Environment = appmodulev2.Environment

Environment is used to get all services to their respective module. Contract: All fields of environment are always populated by runtime.

type GenesisSource added in v0.3.4

type GenesisSource = func(field string) (io.ReadCloser, error)

GenesisSource is a source for genesis data in JSON format. It may abstract over a single JSON object or separate files for each field in a JSON object that can be streamed over. Modules should open a separate io.ReadCloser for each field that is required. When fields represent arrays they can efficiently be streamed over. If there is no data for a field, this function should return nil, nil. It is important that the caller closes the reader when done with it.

type GenesisTarget added in v0.3.4

type GenesisTarget = func(field string) (io.WriteCloser, error)

GenesisTarget is a target for writing genesis data in JSON format. It may abstract over a single JSON object or JSON in separate files that can be streamed over. Modules should open a separate io.WriteCloser for each field and should prefer writing fields as arrays when possible to support efficient iteration. It is important the caller closers the writer AND checks the error when done with it. It is expected that a stream of JSON data is written to the writer.

type HasABCIGenesis added in v1.0.0

type HasABCIGenesis = appmodulev2.HasABCIGenesis

HasABCIGenesis defines a custom genesis handling API implementation for ABCI. (stateful genesis methods which returns validator updates) Most modules should not implement this interface.

type HasAminoCodec added in v1.0.0

type HasAminoCodec interface {
	RegisterLegacyAminoCodec(registry.AminoRegistrar)
}

HasAminoCodec is an extension interface that module must implement to support JSON encoding and decoding of its types through amino. This is used in genesis & the CLI client.

type HasBeginBlocker added in v0.5.0

type HasBeginBlocker = appmodulev2.HasBeginBlocker

HasBeginBlocker is the extension interface that modules should implement to run custom logic before transaction processing in a block.

type HasConsensusVersion added in v1.0.0

type HasConsensusVersion = appmodulev2.HasConsensusVersion

HasConsensusVersion is the interface for declaring a module consensus version.

type HasEndBlocker added in v0.5.0

type HasEndBlocker = appmodulev2.HasEndBlocker

HasEndBlocker is the extension interface that modules should implement to run custom logic after transaction processing in a block.

type HasGenesis added in v0.3.4

type HasGenesis = appmodulev2.HasGenesis

HasGenesis defines a custom genesis handling API implementation.

type HasGenesisAuto added in v1.0.0

type HasGenesisAuto interface {
	appmodulev2.AppModule

	// DefaultGenesis writes the default genesis for this module to the target.
	DefaultGenesis(GenesisTarget) error

	// ValidateGenesis validates the genesis data read from the source.
	ValidateGenesis(GenesisSource) error

	// InitGenesis initializes module state from the genesis source.
	InitGenesis(context.Context, GenesisSource) error

	// ExportGenesis exports module state to the genesis target.
	ExportGenesis(context.Context, GenesisTarget) error
}

HasGenesisAuto is the extension interface that modules should implement to handle genesis data and state initialization. WARNING: This interface is experimental and may change at any time and has been dropped in v2.

type HasGenesisBasics added in v1.0.0

type HasGenesisBasics interface {
	DefaultGenesis() json.RawMessage
	ValidateGenesis(json.RawMessage) error
}

HasGenesisBasics is the legacy interface for stateless genesis methods.

type HasMigrations added in v1.0.0

type HasMigrations = appmodulev2.HasMigrations

HasMigrations is implemented by a module which upgrades or has upgraded to a new consensus version.

type HasPreBlocker added in v0.11.0

type HasPreBlocker = appmodulev2.HasPreBlocker

HasPreBlocker is the extension interface that modules should implement to run custom logic before BeginBlock.

type HasPrecommit added in v0.7.0

type HasPrecommit interface {
	appmodulev2.AppModule
	Precommit(context.Context) error
}

HasPrecommit is an extension interface that contains information about the appmodule.AppModule and Precommit.

type HasPrepareCheckState added in v0.7.0

type HasPrepareCheckState interface {
	appmodulev2.AppModule
	PrepareCheckState(context.Context) error
}

HasPrepareCheckState is an extension interface that contains information about the AppModule and PrepareCheckState.

type HasRegisterInterfaces added in v1.0.0

type HasRegisterInterfaces = appmodulev2.HasRegisterInterfaces

HasRegisterInterfaces is the interface for modules to register their msg types.

type MigrationHandler added in v1.0.0

type MigrationHandler = appmodulev2.MigrationHandler

MigrationHandler is the migration function that each module registers.

type MigrationRegistrar added in v1.0.0

type MigrationRegistrar = appmodulev2.MigrationRegistrar

MigrationRegistrar is the interface for registering in-place store migrations.

type ValidatorUpdate added in v1.0.0

type ValidatorUpdate = appmodulev2.ValidatorUpdate

ValidatorUpdate defines a validator update.

type VersionMap added in v1.0.0

type VersionMap = appmodulev2.VersionMap

VersionMap is a map of moduleName -> version

Directories

Path Synopsis
Package appmodule defines what is needed for a module to be used in the Cosmos SDK (runtime/v2).
Package appmodule defines what is needed for a module to be used in the Cosmos SDK (runtime/v2).

Jump to

Keyboard shortcuts

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