wrrBalancer implements the weighted round robin LB policy.
| 203 | |
| 204 | // wrrBalancer implements the weighted round robin LB policy. |
| 205 | type wrrBalancer struct { |
| 206 | // The following fields are set at initialization time and read only after that, |
| 207 | // so they do not need to be protected by a mutex. |
| 208 | child balancer.Balancer |
| 209 | balancer.ClientConn // Embed to intercept NewSubConn operation |
| 210 | logger *grpclog.PrefixLogger |
| 211 | target string |
| 212 | metricsRecorder estats.MetricsRecorder |
| 213 | |
| 214 | mu sync.Mutex |
| 215 | cfg *lbConfig // active config |
| 216 | locality string |
| 217 | clusterName string |
| 218 | stopPicker *grpcsync.Event |
| 219 | addressWeights *resolver.AddressMapV2[*endpointWeight] |
| 220 | endpointToWeight *resolver.EndpointMap[*endpointWeight] |
| 221 | scToWeight map[balancer.SubConn]*endpointWeight |
| 222 | } |
| 223 | |
| 224 | func (b *wrrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { |
| 225 | if b.logger.V(2) { |
nothing calls this directly
no outgoing calls
no test coverage detected