Documentation
¶
Overview ¶
Package endpointsharding implements a load balancing policy that manages homogeneous child policies each owning a single endpoint.
Experimental ¶
Notice: This package is EXPERIMENTAL and may be changed or removed in a later release.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBalancer ¶
func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options) balancer.Balancer
NewBalancer returns a load balancing policy that manages homogeneous child policies each owning a single endpoint. The endpointsharding balancer forwards the LoadBalancingConfig in ClientConn state updates to its children.
Types ¶
type ChildBuilderFunc ¶ added in v1.71.0
type ChildBuilderFunc func(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer
ChildBuilderFunc creates a new balancer with the ClientConn. It has the same type as the balancer.Builder.Build method.
type ChildState ¶
type ChildState struct {
Endpoint resolver.Endpoint
State balancer.State
// Balancer exposes only the ExitIdler interface of the child LB policy.
// Other methods of the child policy are called only by endpointsharding.
Balancer ExitIdler
}
ChildState is the balancer state of a child along with the endpoint which identifies the child balancer.
func ChildStatesFromPicker ¶
func ChildStatesFromPicker(picker balancer.Picker) []ChildState
ChildStatesFromPicker returns the state of all the children managed by the endpoint sharding balancer that created this picker.
type ExitIdler ¶ added in v1.74.0
type ExitIdler interface {
// ExitIdle instructs the LB policy to reconnect to backends / exit the
// IDLE state, if appropriate and possible. Note that SubConns that enter
// the IDLE state will not reconnect until SubConn.Connect is called.
ExitIdle()
}
ExitIdler provides access to only the ExitIdle method of the child balancer.
type Options ¶ added in v1.71.0
type Options struct {
// DisableAutoReconnect allows the balancer to keep child balancer in the
// IDLE state until they are explicitly triggered to exit using the
// ChildState obtained from the endpointsharding picker. When set to false,
// the endpointsharding balancer will automatically call ExitIdle on child
// connections that report IDLE.
DisableAutoReconnect bool
}
Options are the options to configure the behaviour of the endpointsharding balancer.