indexer

package
v0.0.0-...-5efa85e Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockEventFilterRegistries

type BlockEventFilterRegistries struct {
	BeginBlockEventFilterRegistry *filter.StaticBlockEventFilterRegistry
	EndBlockEventFilterRegistry   *filter.StaticBlockEventFilterRegistry
}

type BlockEventsDBData

type BlockEventsDBData struct {
	// contains filtered or unexported fields
}

type DBData

type DBData struct {
	// contains filtered or unexported fields
}

type Indexer

type Indexer struct {
	Config                              *config.IndexConfig
	DryRun                              bool
	DB                                  *gorm.DB
	ChainClient                         *client.ChainClient
	BlockEnqueueFunction                func(chan *core.EnqueueData) error
	CustomModuleBasics                  []module.AppModuleBasic // Used for extending the AppModuleBasics registered in the probe ChainClientient
	BlockEventFilterRegistries          BlockEventFilterRegistries
	MessageTypeFilters                  []filter.MessageTypeFilter
	CustomBeginBlockEventParserRegistry map[string][]parsers.BlockEventParser // Used for associating parsers to block event types in BeginBlock events
	CustomEndBlockEventParserRegistry   map[string][]parsers.BlockEventParser // Used for associating parsers to block event types in EndBlock events
	CustomBeginBlockParserTrackers      map[string]models.BlockEventParser    // Used for tracking block event parsers in the database
	CustomEndBlockParserTrackers        map[string]models.BlockEventParser    // Used for tracking block event parsers in the database
	CustomMessageParserRegistry         map[string][]parsers.MessageParser    // Used for associating parsers to message types
	CustomMessageParserTrackers         map[string]models.MessageParser       // Used for tracking message parsers in the database
	CustomModels                        []any
	PostIndexCustomMessageFunction      func(*PostIndexCustomMessageDataset) error // Called post indexing of the custom messages with the indexed dataset, useful for custom indexing on the whole dataset or for additional processing
	PostSetupCustomFunction             func(PostSetupCustomDataset) error         // Called post setup of the indexer, useful for custom indexing on the whole dataset or for additional processing
	PostSetupDatasetChannel             chan *PostSetupDataset                     // passes configured indexer data to any reader
	PreExitCustomFunction               func(*PreExitCustomDataset) error          // Called post indexing of the custom messages with the indexed dataset, useful for custom indexing on the whole dataset or for additional processing
}

func (*Indexer) DoDBUpdates

func (indexer *Indexer) DoDBUpdates(wg *sync.WaitGroup, txDataChan chan *DBData, blockEventsDataChan chan *BlockEventsDBData, dbChainID uint)

doDBUpdates will read the data out of the db data chan that had been processed by the workers if this is a dry run, we will simply empty the channel and track progress otherwise we will index the data in the DB. it will also read rewars data and index that.

func (*Indexer) ProcessBlocks

func (indexer *Indexer) ProcessBlocks(wg *sync.WaitGroup, failedBlockHandler core.FailedBlockHandler, blockRPCWorkerChan chan core.IndexerBlockEventData, blockEventsDataChan chan *BlockEventsDBData, txDataChan chan *DBData, chainID uint, blockEventFilterRegistry BlockEventFilterRegistries)

This function is responsible for processing raw RPC data into app-usable types. It handles both block events and transactions. It parses each dataset according to the application configuration requirements and passes the data to the channels that handle the parsed data.

func (*Indexer) RegisterCustomBeginBlockEventParser

func (indexer *Indexer) RegisterCustomBeginBlockEventParser(eventKey string, parser parsers.BlockEventParser)

func (*Indexer) RegisterCustomEndBlockEventParser

func (indexer *Indexer) RegisterCustomEndBlockEventParser(eventKey string, parser parsers.BlockEventParser)

func (*Indexer) RegisterCustomMessageParser

func (indexer *Indexer) RegisterCustomMessageParser(messageKey string, parser parsers.MessageParser)

func (*Indexer) RegisterCustomModels

func (indexer *Indexer) RegisterCustomModels(models []any)

func (*Indexer) RegisterCustomModuleBasics

func (indexer *Indexer) RegisterCustomModuleBasics(basics []module.AppModuleBasic)

func (*Indexer) RegisterMessageTypeFilter

func (indexer *Indexer) RegisterMessageTypeFilter(filter filter.MessageTypeFilter)

type PostIndexCustomMessageDataset

type PostIndexCustomMessageDataset struct {
	Config         config.IndexConfig
	DB             *gorm.DB
	DryRun         bool
	IndexedDataset *[]dbTypes.TxDBWrapper
	MessageParser  map[string]models.MessageParser
	IndexedBlock   models.Block
}

type PostSetupCustomDataset

type PostSetupCustomDataset struct {
	Config config.IndexConfig
	DB     *gorm.DB
}

type PostSetupDataset

type PostSetupDataset struct {
	Config      *config.IndexConfig
	DryRun      bool
	ChainClient *client.ChainClient
}

DB is not safe to add here just yet, since the index command in cmd/ defers a close of the DB connection Maybe the defer should be removed?

type PreExitCustomDataset

type PreExitCustomDataset struct {
	Config config.IndexConfig
	DB     *gorm.DB
	DryRun bool
}

Jump to

Keyboard shortcuts

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