Documentation ¶
Overview ¶
Package block implements the generic block based analyzer.
Block based analyzer uses a BlockProcessor to process blocks and handles the common logic for queueing blocks and support for parallel processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAnalyzer ¶
func NewAnalyzer( blockRange config.BlockRange, batchSize uint64, mode analyzer.BlockAnalysisMode, name string, processor BlockProcessor, target storage.TargetStorage, logger *log.Logger, ) (analyzer.Analyzer, error)
NewAnalyzer returns a new block based analyzer for the provided block processor.
slowSync is a flag that indicates that the analyzer is running in slow-sync mode and it should process blocks in order, ignoring locks as it is assumed it is the only analyzer running.
Types ¶
type BlockProcessor ¶
type BlockProcessor interface { // PreWork performs tasks that need to be done before the main processing loop starts. PreWork(ctx context.Context) error // ProcessBlock processes the provided block, retrieving all required information // from source storage and committing an atomically-executed batch of queries // to target storage. // // The implementation must commit processed blocks (update the analysis.processed_blocks record with processed_time timestamp). ProcessBlock(ctx context.Context, height uint64) error // FinalizeFastSync updates any data that was neglected during the indexing of blocks // up to and including `lastFastSyncHeight`, e.g. dead-reckoned balances. // It is intended to be used when an analyzer wishes to transition from fast-sync mode // into slow-sync mode. If the analyzer never used fast-sync and is starting from // height 0 in slow-sync mode, `lastFastSyncHeight` will be -1. // The method should be a no-op if all the blocks up to `height` have been analyzed // in slow-sync mode, assuming no bugs in dead reckoning code. FinalizeFastSync(ctx context.Context, lastFastSyncHeight int64) error }
BlockProcessor is the interface that block-based processors should implement to use them with the block based analyzer.
Click to show internal directories.
Click to hide internal directories.