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

Method Remove

balancer/weightedtarget/weightedaggregator/aggregator.go:132–146  ·  view source on GitHub ↗

Remove removes the sub-balancer state. Future updates from this sub-balancer, if any, will be ignored.

(id string)

Source from the content-addressed store, hash-verified

130// Remove removes the sub-balancer state. Future updates from this sub-balancer,
131// if any, will be ignored.
132func (wbsa *Aggregator) Remove(id string) {
133 wbsa.mu.Lock()
134 defer wbsa.mu.Unlock()
135 if _, ok := wbsa.idToPickerState[id]; !ok {
136 return
137 }
138 // Setting the state of the deleted sub-balancer to Shutdown will get csEvltr
139 // to remove the previous state for any aggregated state evaluations.
140 // transitions to and from connectivity.Shutdown are ignored by csEvltr.
141 wbsa.csEvltr.RecordTransition(wbsa.idToPickerState[id].stateToAggregate, connectivity.Shutdown)
142 // Remove id and picker from picker map. This also results in future updates
143 // for this ID to be ignored.
144 delete(wbsa.idToPickerState, id)
145 wbsa.buildAndUpdateLocked()
146}
147
148// UpdateWeight updates the weight for the given id. Note that this doesn't
149// trigger an update to the parent ClientConn. The caller should decide when

Callers 4

removeEntryMethod · 0.45
UpdateClientConnStateMethod · 0.45

Calls 4

buildAndUpdateLockedMethod · 0.95
RecordTransitionMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected