cleanup: remove lingering V2 references (#3576)
This commit is contained in:
@ -25,15 +25,12 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/balancer"
|
"google.golang.org/grpc/balancer"
|
||||||
"google.golang.org/grpc/connectivity"
|
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
"google.golang.org/grpc/internal/grpcsync"
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
"google.golang.org/grpc/resolver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ balancer.Balancer = (*rlsBalancer)(nil)
|
_ balancer.Balancer = (*rlsBalancer)(nil)
|
||||||
_ balancer.V2Balancer = (*rlsBalancer)(nil)
|
|
||||||
|
|
||||||
// For overriding in tests.
|
// For overriding in tests.
|
||||||
newRLSClientFunc = newRLSClient
|
newRLSClientFunc = newRLSClient
|
||||||
@ -122,7 +119,7 @@ func (lb *rlsBalancer) UpdateSubConnState(_ balancer.SubConn, _ balancer.SubConn
|
|||||||
|
|
||||||
// Cleans up the resources allocated by the LB policy including the clientConn
|
// Cleans up the resources allocated by the LB policy including the clientConn
|
||||||
// to the RLS server.
|
// to the RLS server.
|
||||||
// Implements balancer.Balancer and balancer.V2Balancer interfaces.
|
// Implements balancer.Balancer.
|
||||||
func (lb *rlsBalancer) Close() {
|
func (lb *rlsBalancer) Close() {
|
||||||
lb.mu.Lock()
|
lb.mu.Lock()
|
||||||
defer lb.mu.Unlock()
|
defer lb.mu.Unlock()
|
||||||
@ -133,16 +130,6 @@ func (lb *rlsBalancer) Close() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleSubConnStateChange implements balancer.Balancer interface.
|
|
||||||
func (lb *rlsBalancer) HandleSubConnStateChange(_ balancer.SubConn, _ connectivity.State) {
|
|
||||||
grpclog.Fatal("UpdateSubConnState should be called instead of HandleSubConnStateChange")
|
|
||||||
}
|
|
||||||
|
|
||||||
// HandleResolvedAddrs implements balancer.Balancer interface.
|
|
||||||
func (lb *rlsBalancer) HandleResolvedAddrs(_ []resolver.Address, _ error) {
|
|
||||||
grpclog.Fatal("UpdateClientConnState should be called instead of HandleResolvedAddrs")
|
|
||||||
}
|
|
||||||
|
|
||||||
// updateControlChannel updates the RLS client if required.
|
// updateControlChannel updates the RLS client if required.
|
||||||
// Caller must hold lb.mu.
|
// Caller must hold lb.mu.
|
||||||
func (lb *rlsBalancer) updateControlChannel(newCfg *lbConfig) {
|
func (lb *rlsBalancer) updateControlChannel(newCfg *lbConfig) {
|
||||||
|
@ -93,7 +93,7 @@ func (s) TestUpdateControlChannelFirstConfig(t *testing.T) {
|
|||||||
if bb == nil {
|
if bb == nil {
|
||||||
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
||||||
}
|
}
|
||||||
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{}).(balancer.V2Balancer)
|
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{})
|
||||||
defer rlsB.Close()
|
defer rlsB.Close()
|
||||||
t.Log("Built RLS LB policy ...")
|
t.Log("Built RLS LB policy ...")
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ func (s) TestUpdateControlChannelSwitch(t *testing.T) {
|
|||||||
if bb == nil {
|
if bb == nil {
|
||||||
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
||||||
}
|
}
|
||||||
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{}).(balancer.V2Balancer)
|
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{})
|
||||||
defer rlsB.Close()
|
defer rlsB.Close()
|
||||||
t.Log("Built RLS LB policy ...")
|
t.Log("Built RLS LB policy ...")
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ func (s) TestUpdateControlChannelTimeout(t *testing.T) {
|
|||||||
if bb == nil {
|
if bb == nil {
|
||||||
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
t.Fatalf("balancer.Get(%s) = nil", rlsBalancerName)
|
||||||
}
|
}
|
||||||
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{}).(balancer.V2Balancer)
|
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{})
|
||||||
defer rlsB.Close()
|
defer rlsB.Close()
|
||||||
t.Log("Built RLS LB policy ...")
|
t.Log("Built RLS LB policy ...")
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ func (s) TestUpdateControlChannelWithCreds(t *testing.T) {
|
|||||||
}
|
}
|
||||||
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{
|
rlsB := bb.Build(&testBalancerCC{}, balancer.BuildOptions{
|
||||||
DialCreds: cCreds,
|
DialCreds: cCreds,
|
||||||
}).(balancer.V2Balancer)
|
})
|
||||||
defer rlsB.Close()
|
defer rlsB.Close()
|
||||||
t.Log("Built RLS LB policy ...")
|
t.Log("Built RLS LB policy ...")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user