Documentation
¶
Index ¶
- func RetryAfterQualifier(_ uint64, lastAttempt time.Time, retryAfter time.Duration) bool
- type Engine
- func (e *Engine) Done() <-chan struct{}
- func (e *Engine) Process(originID flow.Identifier, event interface{}) error
- func (e *Engine) ProcessLocal(event interface{}) error
- func (e *Engine) Ready() <-chan struct{}
- func (e *Engine) Request(request *verification.ChunkDataPackRequest)
- func (e *Engine) Submit(originID flow.Identifier, event interface{})
- func (e *Engine) SubmitLocal(event interface{})
- func (e *Engine) WithChunkDataPackHandler(handler fetcher.ChunkDataPackHandler)
- type RequestQualifierFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine implements a ChunkDataPackRequester that is responsible of receiving chunk data pack requests, dispatching it to the execution nodes, receiving the requested chunk data pack from execution nodes, and passing it to the registered handler.
func New ¶
func New(log zerolog.Logger, state protocol.State, net module.Network, tracer module.Tracer, metrics module.VerificationMetrics, pendingRequests mempool.ChunkRequests, retryInterval time.Duration, reqQualifierFunc RequestQualifierFunc, reqUpdaterFunc mempool.ChunkRequestHistoryUpdaterFunc, requestTargets uint) (*Engine, error)
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done terminates the engine and returns a channel that is closed when the termination is done
func (*Engine) Process ¶
func (e *Engine) Process(originID flow.Identifier, event interface{}) error
Process processes the given event from the node with the given origin ID in a blocking manner. It returns the potential processing error when done.
func (*Engine) ProcessLocal ¶
ProcessLocal processes an event originating on the local node.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready initializes the engine and returns a channel that is closed when the initialization is done.
func (*Engine) Request ¶
func (e *Engine) Request(request *verification.ChunkDataPackRequest)
Request receives a chunk data pack request and adds it into the pending requests mempool.
func (*Engine) Submit ¶
func (e *Engine) Submit(originID flow.Identifier, event interface{})
Submit submits the given event from the node with the given origin ID for processing in a non-blocking manner. It returns instantly and logs a potential processing error internally when done.
func (*Engine) SubmitLocal ¶
func (e *Engine) SubmitLocal(event interface{})
SubmitLocal submits an event originating on the local node.
func (*Engine) WithChunkDataPackHandler ¶
func (e *Engine) WithChunkDataPackHandler(handler fetcher.ChunkDataPackHandler)
type RequestQualifierFunc ¶
type RequestQualifierFunc func(attempts uint64, lastRequested time.Time, retryAfter time.Duration) bool
RequestQualifierFunc is a function type that on receiving the number of attempts a chunk has been requested with, the last time it has been requested, and the duration at which the chunk can be retried after, returns either true or false.
The return value of this function determines whether the chunk request can be dispatched to the network.
func MaxAttemptQualifier ¶
func MaxAttemptQualifier(maxAttempts uint64) RequestQualifierFunc
MaxAttemptQualifier only qualifies a chunk request if it has been requested less than the specified number of attempts.