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

Struct wrrBalancer

balancer/weightedroundrobin/balancer.go:205–222  ·  view source on GitHub ↗

wrrBalancer implements the weighted round robin LB policy.

Source from the content-addressed store, hash-verified

203
204// wrrBalancer implements the weighted round robin LB policy.
205type 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
224func (b *wrrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error {
225 if b.logger.V(2) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected