pool

package
v1.13.9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackoffDuration

type BackoffDuration interface {
	// Duration returns a duration that depends on the given attempt count.
	Duration(attempt int) time.Duration
}

BackoffDuration wraps Duration.

type GRPCClientConnBuilder

type GRPCClientConnBuilder struct {
	// DialTimeout specifies the timeout used when establishing a new
	// connection.
	DialTimeout time.Duration
	// Options is a set of grpc.DialOption to be used when creating a new
	// connection.
	Options []grpc.DialOption

	// TLSConfig is used to build transport credentials for the connection.
	// If not provided, grpc.WithInsecure() is added to Options before creating
	// a new ClientConn.
	TLSConfig certloader.ClientConfigBuilder
}

GRPCClientConnBuilder is a generic ClientConnBuilder implementation.

func (GRPCClientConnBuilder) ClientConn

func (b GRPCClientConnBuilder) ClientConn(target, hostname string) (poolTypes.ClientConn, error)

ClientConn implements ClientConnBuilder.ClientConn.

type Option

type Option func(o *options) error

Option customizes the configuration of the Manager.

func WithBackoff

func WithBackoff(b BackoffDuration) Option

WithBackoff sets the backoff between after a failed connection attempt.

func WithClientConnBuilder

func WithClientConnBuilder(b poolTypes.ClientConnBuilder) Option

WithClientConnBuilder sets the GRPCClientConnBuilder that is used to create new gRPC connections to peers.

func WithConnCheckInterval

func WithConnCheckInterval(i time.Duration) Option

WithConnCheckInterval sets the time interval between peer connections health checks.

func WithLogger

func WithLogger(l logrus.FieldLogger) Option

WithLogger sets the logger to use for logging.

func WithPeerClientBuilder

func WithPeerClientBuilder(b peerTypes.ClientBuilder) Option

WithPeerClientBuilder sets the ClientBuilder that is used to create new Peer service clients.

func WithPeerServiceAddress

func WithPeerServiceAddress(a string) Option

WithPeerServiceAddress sets the address of the peer gRPC service.

func WithRetryTimeout

func WithRetryTimeout(t time.Duration) Option

WithRetryTimeout sets the duration to wait before attempting to re-connect to the peer gRPC service.

type PeerManager

type PeerManager struct {
	// contains filtered or unexported fields
}

PeerManager manages a pool of peers (Peer) and associated gRPC connections. Peers and peer change notifications are obtained from a peer gRPC service.

func NewPeerManager

func NewPeerManager(options ...Option) (*PeerManager, error)

NewPeerManager creates a new manager that connects to a peer gRPC service to manage peers and a connection to every peer's gRPC API.

func (*PeerManager) List

func (m *PeerManager) List() []poolTypes.Peer

List implements observer.PeerLister.List.

func (*PeerManager) ReportOffline

func (m *PeerManager) ReportOffline(name string)

ReportOffline implements observer.PeerReporter.ReportOffline.

func (*PeerManager) Start

func (m *PeerManager) Start()

Start starts the manager.

func (*PeerManager) Stop

func (m *PeerManager) Stop()

Stop stops the manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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