block

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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(
	config *config.BlockBasedAnalyzerConfig,
	name string,
	processor BlockProcessor,
	target storage.TargetStorage,
	logger *log.Logger,
	slowSync bool,
) (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
}

BlockProcessor is the interface that block-based processors should implement to use them with the block based analyzer.

Jump to

Keyboard shortcuts

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