blockconsumer

package
v0.26.8-execution-fix-... Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: AGPL-3.0 Imports: 10 Imported by: 2 modules, 4 packages

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

View Source
const DefaultBlockWorkers = uint64(2)

DefaultBlockWorkers is the number of blocks processed in parallel.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockConsumer

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

BlockConsumer listens to the OnFinalizedBlock event and notifies the consumer to check in the job queue (i.e., its block reader) for new block jobs.

func NewBlockConsumer

func NewBlockConsumer(log zerolog.Logger,
	metrics module.VerificationMetrics,
	processedHeight storage.ConsumerProgress,
	blocks storage.Blocks,
	state protocol.State,
	blockProcessor assigner.FinalizedBlockProcessor,
	maxProcessing uint64) (*BlockConsumer, uint64, error)

NewBlockConsumer creates a new consumer and returns the default processed index for initializing the processed index in storage.

func (*BlockConsumer) Done

func (c *BlockConsumer) Done() <-chan struct{}

func (*BlockConsumer) NotifyJobIsDone

func (c *BlockConsumer) NotifyJobIsDone(jobID module.JobID)

NotifyJobIsDone is invoked by the worker to let the consumer know that it is done processing a (block) job.

func (*BlockConsumer) OnBlockIncorporated

func (c *BlockConsumer) OnBlockIncorporated(*model.Block)

OnBlockIncorporated is to implement FinalizationConsumer

func (*BlockConsumer) OnDoubleProposeDetected

func (c *BlockConsumer) OnDoubleProposeDetected(*model.Block, *model.Block)

OnDoubleProposeDetected is to implement FinalizationConsumer

func (*BlockConsumer) OnFinalizedBlock

func (c *BlockConsumer) OnFinalizedBlock(*model.Block)

OnFinalizedBlock implements FinalizationConsumer, and is invoked by the follower engine whenever a new block is finalized. In this implementation for block consumer, invoking OnFinalizedBlock is enough to only notify the consumer to check its internal queue and move its processing index ahead to the next height if there are workers available. The consumer retrieves the new blocks from its block reader module, hence it does not need to use the parameter of OnFinalizedBlock here.

func (*BlockConsumer) Ready

func (c *BlockConsumer) Ready() <-chan struct{}

func (*BlockConsumer) Size added in v0.17.6

func (c *BlockConsumer) Size() uint

Size returns number of in-memory block jobs that block consumer is processing.

Jump to

Keyboard shortcuts

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