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 WithConnStatusInterval(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
- type PoolMetrics
- type Status
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, insecure credentials are 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 WithConnStatusInterval ¶ added in v1.15.0
WithConnStatusInterval sets the time interval between peer connection status is reported through Prometheus gauge metrics.
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(registry prometheus.Registerer, 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) Status ¶ added in v1.15.0
func (m *PeerManager) Status() Status
Status provides the status of the manager
type PoolMetrics ¶ added in v1.15.0
type PoolMetrics struct { PeerConnStatus *prometheus.GaugeVec // contains filtered or unexported fields }
PoolMetrics holds metrics related to the scope of this package.
func NewPoolMetrics ¶ added in v1.15.0
func NewPoolMetrics(registry prometheus.Registerer) *PoolMetrics
NewPoolMetrics creates a new PoolMetrics object.
func (*PoolMetrics) ObservePeerConnectionStatus ¶ added in v1.15.0
func (m *PoolMetrics) ObservePeerConnectionStatus(peerConnStatus map[connectivity.State]uint32, nilConnNum uint32)
ObservePeerConnectionStatus sets the value of PeerConnStatus gauge metric family. This method is thread-safe.