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

Method Build

internal/xds/balancer/outlierdetection/balancer.go:80–98  ·  view source on GitHub ↗
(cc balancer.ClientConn, bOpts balancer.BuildOptions)

Source from the content-addressed store, hash-verified

78type bb struct{}
79
80func (bb) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Balancer {
81 b := &outlierDetectionBalancer{
82 ClientConn: cc,
83 closed: grpcsync.NewEvent(),
84 done: grpcsync.NewEvent(),
85 addrs: make(map[string]*endpointInfo),
86 scUpdateCh: buffer.NewUnbounded(),
87 pickerUpdateCh: buffer.NewUnbounded(),
88 channelzParent: bOpts.ChannelzParent,
89 endpoints: resolver.NewEndpointMap[*endpointInfo](),
90 metricsRecorder: cc.MetricsRecorder(), // we use an explicit field instead of using cc.MetricsRecorder() so we can override the metric recorder in tests.
91 target: bOpts.Target.String(),
92 }
93 b.logger = prefixLogger(b)
94 b.logger.Infof("Created")
95 b.child = synchronizingBalancerWrapper{lb: gracefulswitch.NewBalancer(b, bOpts)}
96 go b.run()
97 return b
98}
99
100func (bb) ParseConfig(s json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
101 lbCfg := &LBConfig{

Callers

nothing calls this directly

Calls 8

runMethod · 0.95
NewEventFunction · 0.92
NewUnboundedFunction · 0.92
NewBalancerFunction · 0.92
prefixLoggerFunction · 0.70
MetricsRecorderMethod · 0.65
StringMethod · 0.65
InfofMethod · 0.65

Tested by

no test coverage detected