Documentation ¶
Index ¶
- type BackoffDuration
- type GRPCClientConnBuilder
- type Option
- func WithBackoff(b BackoffDuration) Option
- func WithClientConnBuilder(b poolTypes.ClientConnBuilder) Option
- func WithConnCheckInterval(i time.Duration) Option
- func WithLogger(l logrus.FieldLogger) Option
- func WithPeerClientBuilder(b peerTypes.ClientBuilder) Option
- func WithPeerServiceAddress(a string) Option
- func WithRetryTimeout(t time.Duration) Option
- type PeerManager
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 ¶
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 ¶
WithPeerServiceAddress sets the address of the peer gRPC service.
func WithRetryTimeout ¶
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.