Skip to content

Commit

Permalink
Unexport balancerAggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq committed Apr 4, 2024
1 parent f5cc421 commit 944499d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions balancer/balanceraggregator/balanceraggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

// Package balanceraggregator implements a BalancerAggregator helper.
// Package balanceraggregator implements a balancerAggregator helper.
//
// # Experimental
//
Expand Down Expand Up @@ -47,19 +47,19 @@ type ChildState struct {
State balancer.State
}

// NewBalancer returns a new BalancerAggregator.
// NewBalancer returns a new balancerAggregator.
func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer {
return &BalancerAggregator{
return &balancerAggregator{
cc: cc,
bOpts: opts,
children: resolver.NewEndpointMap(),
}

Check warning on line 56 in balancer/balanceraggregator/balanceraggregator.go

View check run for this annotation

Codecov / codecov/patch

balancer/balanceraggregator/balanceraggregator.go#L51-L56

Added lines #L51 - L56 were not covered by tests
}

// BalancerAggregator is a balancer that wraps child balancers. It creates a
// balancerAggregator is a balancer that wraps child balancers. It creates a
// child balancer with child config for every unique Endpoint received. It
// updates the child states on any update from parent or child.
type BalancerAggregator struct {
type balancerAggregator struct {
cc balancer.ClientConn
bOpts balancer.BuildOptions

Expand All @@ -78,7 +78,7 @@ type BalancerAggregator struct {
// the end of the UpdateClientConnState operation. If any endpoint has no
// addresses, returns error. Otherwise returns first error found from a child,
// but fully processes the new update.
func (ba *BalancerAggregator) UpdateClientConnState(state balancer.ClientConnState) error {
func (ba *balancerAggregator) UpdateClientConnState(state balancer.ClientConnState) error {
if len(state.ResolverState.Endpoints) == 0 {
return errors.New("endpoints list is empty")
}

Check warning on line 84 in balancer/balanceraggregator/balanceraggregator.go

View check run for this annotation

Codecov / codecov/patch

balancer/balanceraggregator/balanceraggregator.go#L81-L84

Added lines #L81 - L84 were not covered by tests
Expand Down Expand Up @@ -143,10 +143,10 @@ func (ba *BalancerAggregator) UpdateClientConnState(state balancer.ClientConnSta
return ret

Check warning on line 143 in balancer/balanceraggregator/balanceraggregator.go

View check run for this annotation

Codecov / codecov/patch

balancer/balanceraggregator/balanceraggregator.go#L143

Added line #L143 was not covered by tests
}

// ResolverError forwards the resolver error to all of the BalancerAggregator's
// ResolverError forwards the resolver error to all of the balancerAggregator's
// children and sends a single synchronous update of the childStates at the end
// of the ResolverError operation.
func (ba *BalancerAggregator) ResolverError(err error) {
func (ba *balancerAggregator) ResolverError(err error) {
ba.inhibitChildUpdates.Store(true)
defer func() {
ba.inhibitChildUpdates.Store(false)
Expand All @@ -158,11 +158,11 @@ func (ba *BalancerAggregator) ResolverError(err error) {
}

Check warning on line 158 in balancer/balanceraggregator/balanceraggregator.go

View check run for this annotation

Codecov / codecov/patch

balancer/balanceraggregator/balanceraggregator.go#L149-L158

Added lines #L149 - L158 were not covered by tests
}

func (ba *BalancerAggregator) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
func (ba *balancerAggregator) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
// UpdateSubConnState is deprecated.

Check warning on line 162 in balancer/balanceraggregator/balanceraggregator.go

View check run for this annotation

Codecov / codecov/patch

balancer/balanceraggregator/balanceraggregator.go#L161-L162

Added lines #L161 - L162 were not covered by tests
}

func (ba *BalancerAggregator) Close() {
func (ba *balancerAggregator) Close() {
for _, child := range ba.children.Values() {
bal := child.(balancer.Balancer)
bal.Close()
Expand All @@ -172,7 +172,7 @@ func (ba *BalancerAggregator) Close() {
// updateState updates this component's state. It sends the aggregated state,
// and a picker with round robin behavior with all the child states present if
// needed.
func (ba *BalancerAggregator) updateState() {
func (ba *balancerAggregator) updateState() {
if ba.inhibitChildUpdates.Load() {
return
}
Expand Down Expand Up @@ -236,7 +236,7 @@ func (ba *BalancerAggregator) updateState() {
}

// pickerWithChildStates delegates to the pickers it holds in a round robin
// fashion. It also contains the childStates of all the BalancerAggregator's
// fashion. It also contains the childStates of all the balancerAggregator's
// children.
type pickerWithChildStates struct {
pickers []balancer.Picker
Expand Down Expand Up @@ -266,7 +266,7 @@ type balancerWrapper struct {
balancer.Balancer // Simply forward balancer.Balancer operations.
balancer.ClientConn // embed to intercept UpdateState, doesn't deal with SubConns

ba *BalancerAggregator
ba *balancerAggregator

childState ChildState
}
Expand Down

0 comments on commit 944499d

Please sign in to comment.