provider

package
v0.28.16-only-dapper Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: AGPL-3.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
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

type Engine struct {
	component.Component
	// 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,
	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.

func (*Engine) Process

func (e *Engine) Process(channel channels.Channel, originID flow.Identifier, event 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.

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. This method must be concurrency safe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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