diff --git a/xds/internal/balancer/clusterimpl/clusterimpl.go b/xds/internal/balancer/clusterimpl/clusterimpl.go index df571fab1ed2..006bbaaafa7a 100644 --- a/xds/internal/balancer/clusterimpl/clusterimpl.go +++ b/xds/internal/balancer/clusterimpl/clusterimpl.go @@ -50,11 +50,12 @@ var newXDSClient = func() (xdsClientInterface, error) { return xdsclient.New() } type clusterImplBB struct{} -func (clusterImplBB) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { +func (clusterImplBB) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Balancer { b := &clusterImplBalancer{ ClientConn: cc, + bOpts: bOpts, closed: grpcsync.NewEvent(), - loadWrapper: loadstore.NewLoadStoreWrapper(), + loadWrapper: loadstore.NewWrapper(), pickerUpdateCh: buffer.NewUnbounded(), } b.logger = prefixLogger(b) @@ -88,15 +89,13 @@ type xdsClientInterface interface { type clusterImplBalancer struct { balancer.ClientConn - + bOpts balancer.BuildOptions closed *grpcsync.Event - logger *grpclog.PrefixLogger xdsC xdsClientInterface - config *lbConfig - childLB balancer.Balancer - + config *lbConfig + childLB balancer.Balancer cancelLoadReport func() clusterName string edsServiceName string @@ -128,14 +127,14 @@ func (cib *clusterImplBalancer) updateLoadStore(newConfig *lbConfig) error { cib.edsServiceName = newConfig.EDSServiceName } if updateLoadClusterAndService { - // This updates the clusterName and serviceName that will reported for the - // loads. The update here is too early, the perfect timing is when the - // picker is updated with the new connection. But from this balancer's point - // of view, it's impossible to tell. + // This updates the clusterName and serviceName that will be reported + // for the loads. The update here is too early, the perfect timing is + // when the picker is updated with the new connection. But from this + // balancer's point of view, it's impossible to tell. // // On the other hand, this will almost never happen. Each LRS policy - // shouldn't get updated config. The parent should do a graceful switch when - // the clusterName or serviceName is changed. + // shouldn't get updated config. The parent should do a graceful switch + // when the clusterName or serviceName is changed. cib.loadWrapper.UpdateClusterAndService(cib.clusterName, cib.edsServiceName) } @@ -220,7 +219,7 @@ func (cib *clusterImplBalancer) UpdateClientConnState(s balancer.ClientConnState if cib.childLB != nil { cib.childLB.Close() } - cib.childLB = bb.Build(cib, balancer.BuildOptions{}) + cib.childLB = bb.Build(cib, cib.bOpts) } cib.config = newConfig diff --git a/xds/internal/balancer/clusterimpl/config.go b/xds/internal/balancer/clusterimpl/config.go index e773cc4937cd..548ab34bce4d 100644 --- a/xds/internal/balancer/clusterimpl/config.go +++ b/xds/internal/balancer/clusterimpl/config.go @@ -25,38 +25,6 @@ import ( "google.golang.org/grpc/serviceconfig" ) -/* -message XdsClusterImplLoadBalancingPolicyConfig { - // Cluster name. Required. - string cluster = 1; - - // EDS service name. - // Not set if cluster is not an EDS cluster or if it does not - // specify an EDS service name. - string eds_service_name = 2; - - // Server to send load reports to. - // If unset, no load reporting is done. - // If set to empty string, load reporting will be sent to the same - // server as we are getting xds data from. - google.protobuf.String lrs_load_reporting_server_name = 3; - - // Maximum number of outstanding requests can be made to the upstream cluster. - // Default is 1024. - google.protobuf.UInt32Value max_concurrent_requests = 4; - - // Drop configuration. - message DropCategory { - string category = 1; - uint32 requests_per_million = 2; - } - repeated DropCategory drop_categories = 5; - - // Child policy. - repeated LoadBalancingConfig child_policy = 6; -} -*/ - type dropCategory struct { Category string RequestsPerMillion uint32 diff --git a/xds/internal/balancer/loadstore/load_store_wrapper.go b/xds/internal/balancer/loadstore/load_store_wrapper.go index 13f7c14a7b05..88fa344118cc 100644 --- a/xds/internal/balancer/loadstore/load_store_wrapper.go +++ b/xds/internal/balancer/loadstore/load_store_wrapper.go @@ -25,8 +25,8 @@ import ( "google.golang.org/grpc/xds/internal/client/load" ) -// NewLoadStoreWrapper creates a Wrapper. -func NewLoadStoreWrapper() *Wrapper { +// NewWrapper creates a Wrapper. +func NewWrapper() *Wrapper { return &Wrapper{} } diff --git a/xds/internal/balancer/lrs/balancer.go b/xds/internal/balancer/lrs/balancer.go index decff30db47b..ab9ee7109db1 100644 --- a/xds/internal/balancer/lrs/balancer.go +++ b/xds/internal/balancer/lrs/balancer.go @@ -176,7 +176,7 @@ type xdsClientWrapper struct { func newXDSClientWrapper(c xdsClientInterface) *xdsClientWrapper { return &xdsClientWrapper{ c: c, - loadWrapper: loadstore.NewLoadStoreWrapper(), + loadWrapper: loadstore.NewWrapper(), } }