rpc: Accept interface in place of ClientConn #98

Merged
fyrchik merged 1 commit from fyrchik/frostfs-api-go:clientconn-interface into master 2024-08-01 11:49:46 +00:00
2 changed files with 10 additions and 2 deletions

View file

@ -2,8 +2,16 @@ package client
import (
"io"
"google.golang.org/grpc"
)
// Conn is an interface for grpc client connection.
type Conn interface {
grpc.ClientConnInterface
io.Closer
}
// Conn returns underlying connection.
//
// Returns non-nil result after the first Init() call

View file

@ -25,7 +25,7 @@ type cfg struct {
tlsCfg *tls.Config
grpcDialOpts []grpc.DialOption
conn *grpc.ClientConn
conn Conn
}
const (
@ -114,7 +114,7 @@ func WithTLSCfg(v *tls.Config) Option {
// WithGRPCConn returns option to specify
// gRPC virtual connection.
func WithGRPCConn(v *grpc.ClientConn) Option {
func WithGRPCConn(v Conn) Option {
return func(c *cfg) {
if v != nil {
c.conn = v