modules

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: CC0-1.0 Imports: 10 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module interface {
	// Name returns the module name
	Name() string

	// RunAdditionalOperations runs all the additional operations required to the module.
	// This is the perfect place where to initialize all the operations that subscribe to websockets or other
	// external sources.
	// NOTE. This method will only be run ONCE before starting the parsing of the blocks.
	RunAdditionalOperations(cfg *config.Config, cdc *codec.Codec, cp *client.Proxy, db db.Database) error

	// RegisterPeriodicOperations allows to register all the operations that will be run on a periodic basis.
	// The given scheduler can be used to define the periodicity of each task.
	// NOTE. This method will only be run ONCE during the module initialization.
	RegisterPeriodicOperations(scheduler *gocron.Scheduler, cdc *codec.Codec, cp *client.Proxy, db db.Database) error

	// HandleGenesis allows to handle the genesis state.
	// For convenience of use, the already-unmarshalled AppState is provided along with the full GenesisDoc.
	// NOTE. The returned error will be logged using the logging.LogGenesisError method. All other modules' handlers
	// will still be called.
	HandleGenesis(
		doc *tmtypes.GenesisDoc, appState map[string]json.RawMessage,
		cdc *codec.Codec, cp *client.Proxy, db db.Database,
	) error

	// HandleBlock allows to handle a single block.
	// For convenience of use, all the transactions present inside the given block
	// and the currently used database will be passed as well.
	// For each transaction present inside the block, HandleTx will be called as well.
	// NOTE. The returned error will be logged using the logging.LogBlockError method. All other modules' handlers
	// will still be called.
	HandleBlock(
		block *tmctypes.ResultBlock, txs []*types.Tx, vals *tmctypes.ResultValidators,
		cdc *codec.Codec, cp *client.Proxy, db db.Database,
	) error

	// HandleTx handles a single transaction.
	// For each message present inside the transaction, HandleMsg will be called as well.
	// NOTE. The returned error will be logged using the logging.LogTxError method. All other modules' handlers
	// will still be called.
	HandleTx(tx *types.Tx, cdc *codec.Codec, cp *client.Proxy, db db.Database) error

	// HandleTx handles a single transaction.
	// For convenience of usa, the index of the message inside the transaction and the transaction itself
	// are passed as well.
	// NOTE. The returned error will be logged using the logging.LogMsgError method. All other modules' handlers
	// will still be called.
	HandleMsg(index int, msg sdk.Msg, tx *types.Tx, cdc *codec.Codec, cp *client.Proxy, db db.Database) error
}

Module represents a generic module that has the ability to properly handle the chain data.

type Modules

type Modules []Module

Modules represents a slice of Module objects

func (Modules) FindByName

func (m Modules) FindByName(name string) (module Module, found bool)

FindByName returns the module having the given name inside the m slice. If no modules are found, returns nil and false.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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