Documentation
¶
Index ¶
Constants ¶
const ( // DefaultFetchTimeout is the default initial timeout for fetching ExecutionData from the // db/network. The timeout is increased using an incremental backoff until FetchTimeout. DefaultFetchTimeout = 10 * time.Second // DefaultMaxFetchTimeout is the default timeout for fetching ExecutionData from the db/network DefaultMaxFetchTimeout = 10 * time.Minute // DefaultRetryDelay is the default initial delay used in the exponential backoff for failed // ExecutionData download retries DefaultRetryDelay = 1 * time.Second // DefaultMaxRetryDelay is the default maximum delay used in the exponential backoff for failed // ExecutionData download retries DefaultMaxRetryDelay = 5 * time.Minute // DefaultMaxSearchAhead is the default max number of unsent notifications to allow before // pausing new fetches. DefaultMaxSearchAhead = 5000 )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New( log zerolog.Logger, edrMetrics module.ExecutionDataRequesterMetrics, downloader execution_data.Downloader, execDataCache *cache.ExecutionDataCache, processedHeight storage.ConsumerProgressInitializer, processedNotifications storage.ConsumerProgressInitializer, state protocol.State, headers storage.Headers, cfg ExecutionDataConfig, distributor *ExecutionDataDistributor, ) (state_synchronization.ExecutionDataRequester, error)
New creates a new execution data requester component
Types ¶
type ExecutionDataConfig ¶
type ExecutionDataConfig struct {
// The initial value to use as the last processed block height. This should be the
// first block height to sync - 1
InitialBlockHeight uint64
// Max number of unsent notifications to allow before pausing new fetches. After exceeding this
// limit, the requester will stop processing new finalized block notifications. This prevents
// unbounded memory use by the requester if it gets stuck fetching a specific height.
MaxSearchAhead uint64
// The initial timeout for fetching ExecutionData from the db/network
FetchTimeout time.Duration
// The max timeout for fetching ExecutionData from the db/network
MaxFetchTimeout time.Duration
// Exponential backoff settings for download retries
RetryDelay time.Duration
MaxRetryDelay time.Duration
}
ExecutionDataConfig contains configuration options for the ExecutionDataRequester
type ExecutionDataDistributor ¶ added in v0.30.2
type ExecutionDataDistributor struct {
// contains filtered or unexported fields
}
ExecutionDataDistributor subscribes to execution data received events from the requester and distributes them to subscribers
func NewExecutionDataDistributor ¶ added in v0.30.2
func NewExecutionDataDistributor() *ExecutionDataDistributor
func (*ExecutionDataDistributor) AddOnExecutionDataReceivedConsumer ¶ added in v0.30.2
func (p *ExecutionDataDistributor) AddOnExecutionDataReceivedConsumer(consumer state_synchronization.OnExecutionDataReceivedConsumer)
AddOnExecutionDataReceivedConsumer adds a consumer to be notified when new execution data is received
func (*ExecutionDataDistributor) OnExecutionDataReceived ¶ added in v0.30.2
func (p *ExecutionDataDistributor) OnExecutionDataReceived(executionData *execution_data.BlockExecutionDataEntity)
OnExecutionDataReceived is called when new execution data is received
type ExecutionDataRequester ¶ added in v0.43.0
type ExecutionDataRequester interface {
// RequestExecutionData requests execution data for a given block.
//
// Expected errors:
// - context.Canceled: if the provided context was canceled before completion
// All other errors are unexpected exceptions and may indicate invalid execution data was received.
RequestExecutionData(ctx context.Context) (*execution_data.BlockExecutionData, error)
}
ExecutionDataRequester defines the interface for requesting execution data for a block.
type OneshotExecutionDataConfig ¶ added in v0.42.1
type OneshotExecutionDataConfig struct {
// the initial timeout for fetching execution data from the db/network. The timeout is
// increased using an incremental backoff until FetchTimeout.
FetchTimeout time.Duration
// the max timeout for fetching execution data from the db/network.
MaxFetchTimeout time.Duration
// the initial delay used in the exponential backoff for failed execution data download
// retries.
RetryDelay time.Duration
// the max delay used in the exponential backoff for failed execution data download.
MaxRetryDelay time.Duration
}
OneshotExecutionDataConfig is a config for the oneshot execution data requester. It contains the retry settings for the execution data fetch.
type OneshotExecutionDataRequester ¶ added in v0.42.1
type OneshotExecutionDataRequester struct {
// contains filtered or unexported fields
}
OneshotExecutionDataRequester is a component that requests execution data for a block. It uses a retry mechanism to retry the download execution data if they are not found.
func NewOneshotExecutionDataRequester ¶ added in v0.42.1
func NewOneshotExecutionDataRequester( log zerolog.Logger, metrics module.ExecutionDataRequesterMetrics, execDataDownloader execution_data.Downloader, executionResult *flow.ExecutionResult, blockHeader *flow.Header, config OneshotExecutionDataConfig, ) (*OneshotExecutionDataRequester, error)
NewOneshotExecutionDataRequester creates a new OneshotExecutionDataRequester instance. It validates that the provided block header and execution result are consistent
Parameters:
- log: Logger instance for the requester component
- metrics: Metrics collector for execution data requester operations
- execDataDownloader: Cache for storing and retrieving execution data
- executionResult: The execution result to request data for
- blockHeader: The block header corresponding to the execution result
- config: Configuration settings for the oneshot execution data requester
No errors are expected during normal operations and likely indicate a bug or inconsistent state.
func (*OneshotExecutionDataRequester) RequestExecutionData ¶ added in v0.42.1
func (r *OneshotExecutionDataRequester) RequestExecutionData( ctx context.Context, ) (*execution_data.BlockExecutionData, error)
RequestExecutionData requests execution data for a given block from the network. It performs a fetch using a retry mechanism with exponential backoff if execution data not found. Returns the execution data entity and any error encountered.
Expected errors: - context.Canceled: if the provided context was canceled before completion All other errors are unexpected exceptions and may indicate invalid execution data was received.