Documentation ¶
Index ¶
- type Engine
- func (e *Engine) Done() <-chan struct{}
- func (e *Engine) Process(channel channels.Channel, originID flow.Identifier, message interface{}) error
- func (e *Engine) ProcessLocal(message interface{}) error
- func (e *Engine) Ready() <-chan struct{}
- func (e *Engine) Submit(channel channels.Channel, originID flow.Identifier, message interface{})
- func (e *Engine) SubmitLocal(message interface{})
- type RetrieveFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is a generic provider engine, handling the fulfillment of entity requests on the flow network. It is the `reply` part of the request-reply pattern provided by the pair of generic exchange engines.
func New ¶
func New(log zerolog.Logger, metrics module.EngineMetrics, net network.Network, me module.Local, state protocol.State, channel channels.Channel, selector flow.IdentityFilter, retrieve RetrieveFunc) (*Engine, error)
New creates a new provider engine, operating on the provided network channel, and accepting requests for entities from a node within the set obtained by applying the provided selector filter. It uses the injected retrieve function to manage the fullfilment of these requests.
func (*Engine) Done ¶
func (e *Engine) Done() <-chan struct{}
Done returns a done channel that is closed once the engine has fully stopped. For the consensus engine, we wait for hotstuff to finish.
func (*Engine) Process ¶
func (e *Engine) Process(channel channels.Channel, originID flow.Identifier, message interface{}) error
Process processes the given message 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 message originating on the local node.
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready returns a ready channel that is closed once the engine has fully started. For consensus engine, this is true once the underlying consensus algorithm has started.
func (*Engine) Submit ¶
func (e *Engine) Submit(channel channels.Channel, originID flow.Identifier, message interface{})
Submit submits the given message 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(message interface{})
SubmitLocal submits an message originating on the local node.
type RetrieveFunc ¶
type RetrieveFunc func(flow.Identifier) (flow.Entity, error)
RetrieveFunc is a function provided to the provider engine upon construction. It is used by the engine when receiving requests in order to retrieve the related entities. It is important that the retrieve function return a `storage.ErrNotFound` error if the entity does not exist locally; otherwise, the logic will error and not send responses when failing to retrieve entities.