core

package
v0.0.75 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRPCBlockEvents

func FilterRPCBlockEvents(blockEvents []db.BlockEventDBWrapper, filterRegistry filter.StaticBlockEventFilterRegistry) ([]db.BlockEventDBWrapper, error)

func GenerateBlockFileEnqueueFunction

func GenerateBlockFileEnqueueFunction(cfg config.IndexConfig,
	blockInputFile string, rpcClient clients.ChainRPC,
) (func(chan *EnqueueData) error, error)

func GenerateDefaultEnqueueFunction

func GenerateDefaultEnqueueFunction(db *gorm.DB, cfg config.IndexConfig, chainID uint,
	rpcClient clients.ChainRPC, startBlock, endBlock int64,
) (func(chan *EnqueueData) error, error)

GenerateDefaultEnqueueFunction The default enqueue function will enqueue blocks according to the configuration passed in. It has a few default cases detailed here: Based on whether transaction indexing or block event indexing are enabled, it will choose a start block based on passed in config values. If reindexing is disabled, it will not reindex blocks that have already been indexed. This means it may skip around finding blocks that have not been indexed according to the current configuration. If failed block reattempts are enabled, it will enqueue those according to the passed in configuration as well.

func GenerateMsgTypeEnqueueFunction

func GenerateMsgTypeEnqueueFunction(db *gorm.DB, cfg config.IndexConfig, chainID uint, msgType string, startBlock, endBlock int64) (func(chan *EnqueueData) error, error)

func HandleFailedBlock

func HandleFailedBlock(height int64, code BlockProcessingFailure, err error)

Log error to stdout. Not much else we can do to handle right now.

func InAppTxDecoder

func InAppTxDecoder(cdc probeClient.Codec) sdk.TxDecoder

InAppTxDecoder Provides an in-app tx decoder. The primary use-case for this function is to allow fallback decoding if a TX fails to decode after RPC requests. This can happen in a number of scenarios, but mainly due to missing proto definitions. We can attempt a personal decode of the TX, and see if we can continue indexing based on in-app conditions (such as message type filters). This function skips a large chunk of decoding validations, and is not recommended for general use. Its main point is to skip errors that in default Cosmos TX decoders would cause the entire decode to fail.

func ProcessBlock

func ProcessBlock(blockData *ctypes.ResultBlock, blockResultsData *ctypes.ResultBlockResults, chainID uint) (models.Block, error)

ProcessBlock Process RPC Block data into the model object used by the application.

func ProcessRPCBlockEvents

func ProcessRPCBlockEvents(block *models.Block, blockEvents []abci.Event, blockLifecyclePosition models.BlockLifecyclePosition, uniqueEventTypes map[string]models.BlockEventType, uniqueAttributeKeys map[string]models.BlockEventAttributeKey, customParsers map[string][]parsers.BlockEventParser, conf config.IndexConfig) ([]db.BlockEventDBWrapper, error)

func ProcessRPCBlockResults

func ProcessRPCBlockResults(conf config.IndexConfig, block models.Block, blockResults *ctypes.ResultBlockResults, customBeginBlockParsers map[string][]parsers.BlockEventParser, customEndBlockParsers map[string][]parsers.BlockEventParser) (*db.BlockDBWrapper, error)

Types

type BlockProcessingFailure

type BlockProcessingFailure int
const (
	NodeMissingBlockTxs BlockProcessingFailure = iota
	BlockQueryError
	UnprocessableTxError
	OsmosisNodeRewardLookupError
	OsmosisNodeRewardIndexError
	NodeMissingHistoryForBlock
	FailedBlockEventHandling
)

type BlockRPCWorker

type BlockRPCWorker interface {
	Worker(wg *sync.WaitGroup,
		blockEnqueueChan chan *EnqueueData,
		result chan<- IndexerBlockEventData,
		ignoreExisting bool)
}

func NewBlockRPCWorker

func NewBlockRPCWorker(
	chainStringID string,
	cfg *config.IndexConfig,
	chainClient *client.ChainClient,
	db *gorm.DB,
	rpcClient clients.ChainRPC,
) BlockRPCWorker

type EnqueueData

type EnqueueData struct {
	Height            int64
	IndexBlockEvents  bool
	IndexTransactions bool
}

type FailedBlockHandler

type FailedBlockHandler func(height int64, code BlockProcessingFailure, err error)

type IndexerBlockEventData

type IndexerBlockEventData struct {
	BlockData                *ctypes.ResultBlock
	BlockResultsData         *ctypes.ResultBlockResults
	BlockEventRequestsFailed bool
	GetTxsResponse           *txTypes.GetTxsEventResponse
	TxRequestsFailed         bool
	IndexBlockEvents         bool
	IndexTransactions        bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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