async

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAgents = errors.New("no agent factories defined")

Functions

This section is empty.

Types

type AgentStarter

type AgentStarter []Factory

AgentStarter groups a set of factories to be used

func (AgentStarter) Start

func (a AgentStarter) Start(
	ctx context.Context,
	agents []*config.AsyncAgent,
	logger logging.Logger,
	agentPing chan<- string,
	pf proxy.Factory,
) func() error

Start executes all the factories for each async agent configuration

type Factory

type Factory func(context.Context, Options) bool

Factory is a function able to start an async agent

type Options

type Options struct {
	// Agent keeps the configuration for the async agent
	Agent *config.AsyncAgent
	// Endpoint encapsulates the configuration for the associated pipe
	Endpoint *config.EndpointConfig
	// Proxy is the pipe associated with the async agent
	Proxy proxy.Proxy
	// AgentPing is the channel for the agent to send ping messages
	AgentPing chan<- string
	// G is the error group responsible for managing the agents and the router itself
	G *errgroup.Group
	// ShouldContinue is a function signaling when to stop the connection retries
	ShouldContinue func(int) bool
	// BackoffF is a function encapsulating the backoff strategy
	BackoffF backoff.TimeToWaitBeforeRetry
	Logger   logging.Logger
}

Options contains the configuration to pass to the async agent factory

Jump to

Keyboard shortcuts

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