mirror of https://github.com/grpc/grpc-go.git
balancer: Enforce embedding the SubConn interface in implementations (#7758)
This commit is contained in:
parent
2de6df9c6f
commit
43ee17261c
|
@ -155,6 +155,9 @@ type SubConn interface {
|
|||
// indicate the shutdown operation. This may be delivered before
|
||||
// in-progress RPCs are complete and the actual connection is closed.
|
||||
Shutdown()
|
||||
// enforceEmbedding is an unexported method to force implementers embed
|
||||
// this interface, allowing gRPC to add methods without breaking users.
|
||||
enforceEmbedding()
|
||||
}
|
||||
|
||||
// NewSubConnOptions contains options to create new SubConn.
|
||||
|
|
|
@ -41,6 +41,7 @@ func (c *testClientConn) NewSubConn(addrs []resolver.Address, opts balancer.NewS
|
|||
func (c *testClientConn) UpdateState(balancer.State) {}
|
||||
|
||||
type testSubConn struct {
|
||||
balancer.SubConn
|
||||
updateState func(balancer.SubConnState)
|
||||
}
|
||||
|
||||
|
|
|
@ -254,6 +254,7 @@ func (ccb *ccBalancerWrapper) Target() string {
|
|||
// acBalancerWrapper is a wrapper on top of ac for balancers.
|
||||
// It implements balancer.SubConn interface.
|
||||
type acBalancerWrapper struct {
|
||||
balancer.SubConn
|
||||
ac *addrConn // read-only
|
||||
ccb *ccBalancerWrapper // read-only
|
||||
stateListener func(balancer.SubConnState)
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
|
||||
// TestSubConn implements the SubConn interface, to be used in tests.
|
||||
type TestSubConn struct {
|
||||
balancer.SubConn
|
||||
tcc *BalancerClientConn // the CC that owns this SubConn
|
||||
id string
|
||||
ConnectCh chan struct{}
|
||||
|
|
Loading…
Reference in New Issue