-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(balancer): update ClientConn to use ClientConnWrapper
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package balancer | ||
|
||
import ( | ||
"google.golang.org/grpc/balancer" | ||
estats "google.golang.org/grpc/experimental/stats" | ||
"google.golang.org/grpc/resolver" | ||
) | ||
|
||
// ClientConnWrapper is an interface that wraps the gRPC ClientConn interface. | ||
type ClientConnWrapper interface { | ||
// NewSubConn creates a new SubConn with the specified addresses and options. | ||
NewSubConn([]resolver.Address, balancer.NewSubConnOptions) (balancer.SubConn, error) | ||
// RemoveSubConn removes the specified SubConn. | ||
RemoveSubConn(balancer.SubConn) | ||
// UpdateAddresses updates the addresses for the specified SubConn. | ||
UpdateAddresses(balancer.SubConn, []resolver.Address) | ||
// UpdateState updates the overall connectivity state of the balancer. | ||
UpdateState(balancer.State) | ||
// ResolveNow triggers an immediate resolution of the target. | ||
ResolveNow(resolver.ResolveNowOptions) | ||
// Target returns the target URI of the connection. | ||
Target() string | ||
// MetricsRecorder returns the metrics recorder for the connection. | ||
MetricsRecorder() estats.MetricsRecorder | ||
} |