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

Method Build

balancer/weightedroundrobin/balancer.go:102–118  ·  view source on GitHub ↗
(cc balancer.ClientConn, bOpts balancer.BuildOptions)

Source from the content-addressed store, hash-verified

100type bb struct{}
101
102func (bb) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Balancer {
103 b := &wrrBalancer{
104 ClientConn: cc,
105 target: bOpts.Target.String(),
106 metricsRecorder: cc.MetricsRecorder(),
107 addressWeights: resolver.NewAddressMapV2[*endpointWeight](),
108 endpointToWeight: resolver.NewEndpointMap[*endpointWeight](),
109 scToWeight: make(map[balancer.SubConn]*endpointWeight),
110 }
111
112 b.child = endpointsharding.NewBalancer(b, bOpts, balancer.Get(pickfirst.Name).Build, endpointsharding.Options{})
113 b.logger = prefixLogger(b)
114 if b.logger.V(2) {
115 b.logger.Infof("Created")
116 }
117 return b
118}
119
120func (bb) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
121 lbCfg := &lbConfig{

Callers

nothing calls this directly

Calls 7

NewBalancerFunction · 0.92
GetFunction · 0.92
prefixLoggerFunction · 0.70
StringMethod · 0.65
MetricsRecorderMethod · 0.65
VMethod · 0.65
InfofMethod · 0.65

Tested by

no test coverage detected