newCCBalancerWrapper creates a new balancer wrapper in idle state. The underlying balancer is not created until the updateClientConnState() method is invoked.
(cc *ClientConn)
| 82 | // underlying balancer is not created until the updateClientConnState() method |
| 83 | // is invoked. |
| 84 | func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { |
| 85 | ctx, cancel := context.WithCancel(cc.ctx) |
| 86 | ccb := &ccBalancerWrapper{ |
| 87 | cc: cc, |
| 88 | opts: balancer.BuildOptions{ |
| 89 | DialCreds: cc.dopts.copts.TransportCredentials, |
| 90 | CredsBundle: cc.dopts.copts.CredsBundle, |
| 91 | Dialer: cc.dopts.copts.Dialer, |
| 92 | Authority: cc.authority, |
| 93 | CustomUserAgent: cc.dopts.copts.UserAgent, |
| 94 | ChannelzParent: cc.channelz, |
| 95 | Target: cc.parsedTarget, |
| 96 | }, |
| 97 | serializer: grpcsync.NewCallbackSerializer(ctx), |
| 98 | serializerCancel: cancel, |
| 99 | } |
| 100 | ccb.balancer = gracefulswitch.NewBalancer(ccb, ccb.opts) |
| 101 | return ccb |
| 102 | } |
| 103 | |
| 104 | func (ccb *ccBalancerWrapper) MetricsRecorder() stats.MetricsRecorder { |
| 105 | return ccb.cc.metricsRecorderList |
no test coverage detected