package endpointsharding
import "google.golang.org/grpc/balancer/endpointsharding"
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 ¶
- func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options) balancer.Balancer
- type ChildBuilderFunc
- type ChildState
- type Options
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 ¶
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 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 Options ¶
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.
Source Files ¶
endpointsharding.go
- Version
- v1.71.1 (latest)
- Published
- Mar 28, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 21 hours ago –
Tools for package owners.