Documentation ¶
Overview ¶
Package edsbalancer implements a balancer to handle EDS responses.
Index ¶
- type EDSBalancer
- func (xdsB *EDSBalancer) Close()
- func (xdsB *EDSBalancer) HandleChildPolicy(name string, config json.RawMessage)
- func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment)
- func (xdsB *EDSBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State)
- func (xdsB *EDSBalancer) UpdateBalancerState(s connectivity.State, p balancer.Picker)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EDSBalancer ¶
type EDSBalancer struct { balancer.ClientConn // contains filtered or unexported fields }
EDSBalancer does load balancing based on the EDS responses. Note that it doesn't implement the balancer interface. It's intended to be used by a high level balancer implementation.
The localities are picked as weighted round robin. A configurable child policy is used to manage endpoints in each locality.
func NewXDSBalancer ¶
func NewXDSBalancer(cc balancer.ClientConn, loadStore lrs.Store) *EDSBalancer
NewXDSBalancer create a new EDSBalancer.
func (*EDSBalancer) HandleChildPolicy ¶
func (xdsB *EDSBalancer) HandleChildPolicy(name string, config json.RawMessage)
HandleChildPolicy updates the child balancers handling endpoints. Child policy is roundrobin by default. If the specified balancer is not installed, the old child balancer will be used.
HandleChildPolicy and HandleEDSResponse must be called by the same goroutine.
func (*EDSBalancer) HandleEDSResponse ¶
func (xdsB *EDSBalancer) HandleEDSResponse(edsResp *edspb.ClusterLoadAssignment)
HandleEDSResponse handles the EDS response and creates/deletes localities and SubConns. It also handles drops.
HandleCDSResponse and HandleEDSResponse must be called by the same goroutine.
func (*EDSBalancer) HandleSubConnStateChange ¶
func (xdsB *EDSBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State)
HandleSubConnStateChange handles the state change and update pickers accordingly.
func (*EDSBalancer) UpdateBalancerState ¶
func (xdsB *EDSBalancer) UpdateBalancerState(s connectivity.State, p balancer.Picker)
UpdateBalancerState overrides balancer.ClientConn to wrap the picker in a dropPicker.