Aggregator is the weighted balancer state aggregator.
| 54 | |
| 55 | // Aggregator is the weighted balancer state aggregator. |
| 56 | type Aggregator struct { |
| 57 | cc balancer.ClientConn |
| 58 | logger *grpclog.PrefixLogger |
| 59 | newWRR func() wrr.WRR |
| 60 | |
| 61 | csEvltr *balancer.ConnectivityStateEvaluator |
| 62 | |
| 63 | mu sync.Mutex |
| 64 | // If started is false, no updates should be sent to the parent cc. A closed |
| 65 | // sub-balancer could still send pickers to this aggregator. This makes sure |
| 66 | // that no updates will be forwarded to parent when the whole balancer group |
| 67 | // and states aggregator is closed. |
| 68 | started bool |
| 69 | // All balancer IDs exist as keys in this map, even if balancer group is not |
| 70 | // started. |
| 71 | // |
| 72 | // If an ID is not in map, it's either removed or never added. |
| 73 | idToPickerState map[string]*weightedPickerState |
| 74 | // Set when UpdateState call propagation is paused. |
| 75 | pauseUpdateState bool |
| 76 | // Set when UpdateState call propagation is paused and an UpdateState call |
| 77 | // is suppressed. |
| 78 | needUpdateStateOnResume bool |
| 79 | } |
| 80 | |
| 81 | // New creates a new weighted balancer state aggregator. |
| 82 | func New(cc balancer.ClientConn, logger *grpclog.PrefixLogger, newWRR func() wrr.WRR) *Aggregator { |
nothing calls this directly
no outgoing calls
no test coverage detected