grpc: google.golang.org/grpc/xds/internal/balancer/weightedtarget/weightedaggregator Index | Files

package weightedaggregator

import "google.golang.org/grpc/xds/internal/balancer/weightedtarget/weightedaggregator"

Package weightedaggregator implements state aggregator for weighted_target balancer.

This is a separate package so it can be shared by weighted_target and eds. The eds balancer will be refactored to use weighted_target directly. After that, all functions and structs in this package can be moved to package weightedtarget and unexported.

Index

Package Files

aggregator.go

type Aggregator Uses

type Aggregator struct {
    // contains filtered or unexported fields
}

Aggregator is the weighted balancer state aggregator.

func New Uses

func New(cc balancer.ClientConn, logger *grpclog.PrefixLogger, newWRR func() wrr.WRR) *Aggregator

New creates a new weighted balancer state aggregator.

func (*Aggregator) Add Uses

func (wbsa *Aggregator) Add(id internal.LocalityID, weight uint32)

Add adds a sub-balancer state with weight. It adds a place holder, and waits for the real sub-balancer to update state.

func (*Aggregator) BuildAndUpdate Uses

func (wbsa *Aggregator) BuildAndUpdate()

BuildAndUpdate combines the sub-state from each sub-balancer into one state, and update it to parent ClientConn.

func (*Aggregator) Remove Uses

func (wbsa *Aggregator) Remove(id internal.LocalityID)

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

func (*Aggregator) Start Uses

func (wbsa *Aggregator) Start()

Start starts the aggregator. It can be called after Close to restart the aggretator.

func (*Aggregator) Stop Uses

func (wbsa *Aggregator) Stop()

Stop stops the aggregator. When the aggregator is closed, it won't call parent ClientConn to update balancer state.

func (*Aggregator) UpdateState Uses

func (wbsa *Aggregator) UpdateState(id internal.LocalityID, newState balancer.State)

UpdateState is called to report a balancer state change from sub-balancer. It's usually called by the balancer group.

It calls parent ClientConn's UpdateState with the new aggregated state.

func (*Aggregator) UpdateWeight Uses

func (wbsa *Aggregator) UpdateWeight(id internal.LocalityID, newWeight uint32)

UpdateWeight updates the weight for the given id. Note that this doesn't trigger an update to the parent ClientConn. The caller should decide when it's necessary, and call BuildAndUpdate.

Package weightedaggregator imports 8 packages (graph) and is imported by 2 packages. Updated 2020-07-29. Refresh now. Tools for package owners.