Add adds a sub-balancer state with weight. It adds a place holder, and waits for the real sub-balancer to update state.
(id string, weight uint32)
| 109 | // Add adds a sub-balancer state with weight. It adds a place holder, and waits for |
| 110 | // the real sub-balancer to update state. |
| 111 | func (wbsa *Aggregator) Add(id string, weight uint32) { |
| 112 | wbsa.mu.Lock() |
| 113 | defer wbsa.mu.Unlock() |
| 114 | wbsa.idToPickerState[id] = &weightedPickerState{ |
| 115 | weight: weight, |
| 116 | // Start everything in CONNECTING, so if one of the sub-balancers |
| 117 | // reports TransientFailure, the RPCs will still wait for the other |
| 118 | // sub-balancers. |
| 119 | state: balancer.State{ |
| 120 | ConnectivityState: connectivity.Connecting, |
| 121 | Picker: base.NewErrPicker(balancer.ErrNoSubConnAvailable), |
| 122 | }, |
| 123 | stateToAggregate: connectivity.Connecting, |
| 124 | } |
| 125 | wbsa.csEvltr.RecordTransition(connectivity.Shutdown, connectivity.Connecting) |
| 126 | |
| 127 | wbsa.buildAndUpdateLocked() |
| 128 | } |
| 129 | |
| 130 | // Remove removes the sub-balancer state. Future updates from this sub-balancer, |
| 131 | // if any, will be ignored. |
nothing calls this directly
no test coverage detected