indexer

package
v0.33.17-new-ingestion... Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIndexNotInitialized = errors.New("index not initialized")

ErrIndexNotInitialized is returned when the indexer is not initialized

This generally indicates that the index databases are still being initialized, and trying again later may succeed

Functions

func HandleCollection added in v0.33.15

func HandleCollection(
	collection *flow.Collection,
	collections storage.Collections,
	transactions storage.Transactions,
	logger zerolog.Logger,
	collectionExecutedMetric module.CollectionExecutedMetric,
) error

HandleCollection handles the response of the a collection request made earlier when a block was received. No errors expected during normal operations.

Types

type CollectionExecutedMetricImpl added in v0.33.15

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

CollectionExecutedMetricImpl tracks metrics to measure how long it takes for tx to reach each step in their lifecycle

func NewCollectionExecutedMetricImpl added in v0.33.15

func NewCollectionExecutedMetricImpl(
	log zerolog.Logger,
	accessMetrics module.AccessMetrics,
	collectionsToMarkFinalized *stdmap.Times,
	collectionsToMarkExecuted *stdmap.Times,
	blocksToMarkExecuted *stdmap.Times,
	collections storage.Collections,
	blocks storage.Blocks,
) (*CollectionExecutedMetricImpl, error)

func (*CollectionExecutedMetricImpl) BlockFinalized added in v0.33.15

func (c *CollectionExecutedMetricImpl) BlockFinalized(block *flow.Block)

BlockFinalized tracks finalized metric for block

func (*CollectionExecutedMetricImpl) CollectionExecuted added in v0.33.15

func (c *CollectionExecutedMetricImpl) CollectionExecuted(light flow.LightCollection)

CollectionExecuted tracks collections to mark executed

func (*CollectionExecutedMetricImpl) CollectionFinalized added in v0.33.15

func (c *CollectionExecutedMetricImpl) CollectionFinalized(light flow.LightCollection)

CollectionFinalized tracks collections to mark finalized

func (*CollectionExecutedMetricImpl) ExecutionReceiptReceived added in v0.33.15

func (c *CollectionExecutedMetricImpl) ExecutionReceiptReceived(r *flow.ExecutionReceipt)

ExecutionReceiptReceived tracks execution receipt metrics

func (*CollectionExecutedMetricImpl) UpdateLastFullBlockHeight added in v0.33.15

func (c *CollectionExecutedMetricImpl) UpdateLastFullBlockHeight(height uint64)

type Indexer

type Indexer struct {
	component.Component
	// contains filtered or unexported fields
}

Indexer handles ingestion of new execution data available and uses the execution data indexer module to index the data. The processing of new available data is done by creating a jobqueue that uses the execution data reader to obtain new jobs. The worker also implements the `highestConsecutiveHeight` method which is used by the execution data reader, so it doesn't surpass the highest sealed block height when fetching the data. The execution state worker has a callback that is used by the upstream queues which download new execution data to notify new data is available and kick off indexing.

func NewIndexer

func NewIndexer(
	log zerolog.Logger,
	initHeight uint64,
	registers storage.RegisterIndex,
	indexer *IndexerCore,
	executionCache *cache.ExecutionDataCache,
	executionDataLatestHeight func() (uint64, error),
	processedHeight storage.ConsumerProgress,
) (*Indexer, error)

NewIndexer creates a new execution worker.

func (*Indexer) HighestIndexedHeight

func (i *Indexer) HighestIndexedHeight() (uint64, error)

HighestIndexedHeight returns the highest height indexed by the execution indexer.

func (*Indexer) LowestIndexedHeight

func (i *Indexer) LowestIndexedHeight() (uint64, error)

LowestIndexedHeight returns the lowest height indexed by the execution indexer.

func (*Indexer) OnExecutionData

func (i *Indexer) OnExecutionData(_ *execution_data.BlockExecutionDataEntity)

OnExecutionData is used to notify when new execution data is downloaded by the execution data requester jobqueue.

func (*Indexer) Start

func (i *Indexer) Start(ctx irrecoverable.SignalerContext)

Start the worker jobqueue to consume the available data.

type IndexerCore

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

IndexerCore indexes the execution state.

func New

func New(
	log zerolog.Logger,
	metrics module.ExecutionStateIndexerMetrics,
	batcher bstorage.BatchBuilder,
	registers storage.RegisterIndex,
	headers storage.Headers,
	events storage.Events,
	collections storage.Collections,
	transactions storage.Transactions,
	results storage.LightTransactionResults,
	chain flow.Chain,
	derivedChainData *derived.DerivedChainData,
	collectionExecutedMetric module.CollectionExecutedMetric,
) (*IndexerCore, error)

New execution state indexer used to ingest block execution data and index it by height. The passed RegisterIndex storage must be populated to include the first and last height otherwise the indexer won't be initialized to ensure we have bootstrapped the storage first.

func (*IndexerCore) IndexBlockData

func (c *IndexerCore) IndexBlockData(data *execution_data.BlockExecutionDataEntity) error

IndexBlockData indexes all execution block data by height. This method shouldn't be used concurrently. Expected errors: - storage.ErrNotFound if the block for execution data was not found

func (*IndexerCore) RegisterValue added in v0.32.7

func (c *IndexerCore) RegisterValue(ID flow.RegisterID, height uint64) (flow.RegisterValue, error)

RegisterValue retrieves register values by the register IDs at the provided block height. Even if the register wasn't indexed at the provided height, returns the highest height the register was indexed at. If a register is not found it will return a nil value and not an error. Expected errors: - storage.ErrHeightNotIndexed if the given height was not indexed yet or lower than the first indexed height.

Jump to

Keyboard shortcuts

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