Documentation ¶
Index ¶
Constants ¶
const ( // DefaultRequestProviderWorkers is the default number of workers used to process entity requests. DefaultRequestProviderWorkers = uint(5) // DefaultEntityRequestCacheSize is the default max message queue size for the provider engine. // This equates to ~5GB of memory usage with a full queue (10M*500) DefaultEntityRequestCacheSize = 500 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
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, requestQueue engine.MessageStore, requestWorkers uint, 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.
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.