MCPcopy
hub / github.com/grpc/grpc-go / NewBalancer

Function NewBalancer

balancer/endpointsharding/endpointsharding.go:79–88  ·  view source on GitHub ↗

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.

(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options)

Source from the content-addressed store, hash-verified

77// policies each owning a single endpoint. The endpointsharding balancer
78// forwards the LoadBalancingConfig in ClientConn state updates to its children.
79func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options) balancer.Balancer {
80 es := &endpointSharding{
81 cc: cc,
82 bOpts: opts,
83 esOpts: esOpts,
84 childBuilder: childBuilder,
85 }
86 es.children.Store(resolver.NewEndpointMap[*balancerWrapper]())
87 return es
88}
89
90// endpointSharding is a balancer that wraps child balancers. It creates a child
91// balancer with child config for every unique Endpoint received. It updates the

Callers 9

BuildMethod · 0.92
BuildMethod · 0.92
BuildMethod · 0.92
BuildMethod · 0.92
BuildMethod · 0.92
BuildMethod · 0.92
BuildMethod · 0.92

Calls

no outgoing calls

Tested by 3

BuildMethod · 0.74