Documentation ¶
Overview ¶
Package gracefulswitch implements a graceful switch load balancer.
Index ¶
- type Balancer
- func (gsb *Balancer) Close()
- func (gsb *Balancer) ExitIdle()
- func (gsb *Balancer) ResolverError(err error)
- func (gsb *Balancer) SwitchTo(builder balancer.Builder) error
- func (gsb *Balancer) UpdateClientConnState(state balancer.ClientConnState) error
- func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balancer ¶
type Balancer struct {
// contains filtered or unexported fields
}
Balancer is a utility to gracefully switch from one balancer to a new balancer. It implements the balancer.Balancer interface.
func NewBalancer ¶
func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions) *Balancer
NewBalancer returns a graceful switch Balancer.
func (*Balancer) ExitIdle ¶
func (gsb *Balancer) ExitIdle()
ExitIdle forwards the call to the latest balancer created.
If the latest balancer does not support ExitIdle, the subConns are re-connected to manually.
func (*Balancer) ResolverError ¶
ResolverError forwards the error to the latest balancer created.
func (*Balancer) SwitchTo ¶
SwitchTo initializes the graceful switch process, which completes based on connectivity state changes on the current/pending balancer. Thus, the switch process is not complete when this method returns. This method must be called synchronously alongside the rest of the balancer.Balancer methods this Graceful Switch Balancer implements.
func (*Balancer) UpdateClientConnState ¶
func (gsb *Balancer) UpdateClientConnState(state balancer.ClientConnState) error
UpdateClientConnState forwards the update to the latest balancer created.
func (*Balancer) UpdateSubConnState ¶
func (gsb *Balancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState)
UpdateSubConnState forwards the update to the appropriate child.