Documentation ¶
Overview ¶
Package balancer implements client balancer.
Index ¶
- Variables
- type DialFunc
- type GRPC17Health
- func (b *GRPC17Health) Close() error
- func (b *GRPC17Health) ConnectNotify() <-chan struct{}
- func (b *GRPC17Health) Endpoint(hostPort string) string
- func (b *GRPC17Health) Get(ctx context.Context, opts grpc.BalancerGetOptions) (grpc.Address, func(), error)
- func (b *GRPC17Health) HostPortError(hostPort string, err error)
- func (b *GRPC17Health) NeedUpdate() bool
- func (b *GRPC17Health) Next()
- func (b *GRPC17Health) Notify() <-chan []grpc.Address
- func (b *GRPC17Health) Pinned() string
- func (b *GRPC17Health) Ready() <-chan struct{}
- func (b *GRPC17Health) Start(target string, config grpc.BalancerConfig) error
- func (b *GRPC17Health) StopC() chan struct{}
- func (b *GRPC17Health) Up(addr grpc.Address) func(error)
- func (b *GRPC17Health) UpdateAddrs(eps ...string)
- func (b *GRPC17Health) UpdateAddrsC() chan NotifyMsg
- type NotifyMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoAddrAvilable = status.Error(codes.Unavailable, "there is no address available")
ErrNoAddrAvilable is returned by Get() when the balancer does not have any active connection to endpoints at the time. This error is returned only when opts.BlockingWait is true.
Functions ¶
This section is empty.
Types ¶
type DialFunc ¶
type DialFunc func(ep string, dopts ...grpc.DialOption) (*grpc.ClientConn, error)
DialFunc defines gRPC dial function.
type GRPC17Health ¶
type GRPC17Health struct {
// contains filtered or unexported fields
}
GRPC17Health does the bare minimum to expose multiple eps to the grpc reconnection code path
func NewGRPC17Health ¶
func NewGRPC17Health( eps []string, timeout time.Duration, dialFunc DialFunc, ) *GRPC17Health
NewGRPC17Health returns a new health balancer with gRPC v1.7.
func (*GRPC17Health) Close ¶
func (b *GRPC17Health) Close() error
func (*GRPC17Health) ConnectNotify ¶
func (b *GRPC17Health) ConnectNotify() <-chan struct{}
func (*GRPC17Health) Endpoint ¶
func (b *GRPC17Health) Endpoint(hostPort string) string
func (*GRPC17Health) Get ¶
func (b *GRPC17Health) Get(ctx context.Context, opts grpc.BalancerGetOptions) (grpc.Address, func(), error)
func (*GRPC17Health) HostPortError ¶
func (b *GRPC17Health) HostPortError(hostPort string, err error)
func (*GRPC17Health) NeedUpdate ¶
func (b *GRPC17Health) NeedUpdate() bool
NeedUpdate returns true if all connections are down or addresses do not include current pinned address.
func (*GRPC17Health) Next ¶
func (b *GRPC17Health) Next()
func (*GRPC17Health) Notify ¶
func (b *GRPC17Health) Notify() <-chan []grpc.Address
func (*GRPC17Health) Pinned ¶
func (b *GRPC17Health) Pinned() string
func (*GRPC17Health) Ready ¶
func (b *GRPC17Health) Ready() <-chan struct{}
func (*GRPC17Health) Start ¶
func (b *GRPC17Health) Start(target string, config grpc.BalancerConfig) error
func (*GRPC17Health) StopC ¶
func (b *GRPC17Health) StopC() chan struct{}
func (*GRPC17Health) UpdateAddrs ¶
func (b *GRPC17Health) UpdateAddrs(eps ...string)
func (*GRPC17Health) UpdateAddrsC ¶
func (b *GRPC17Health) UpdateAddrsC() chan NotifyMsg
Click to show internal directories.
Click to hide internal directories.