Allow to pass gRPC dial options when creating client #82

Merged
fyrchik merged 1 commit from feat/pass_grpc_options into master 2023-05-31 10:25:11 +00:00

View file

@ -10,6 +10,7 @@ import (
v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
"google.golang.org/grpc"
)
// Client represents virtual connection to the FrostFS network to communicate
@ -101,6 +102,7 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error {
client.WithNetworkURIAddress(prm.endpoint, prm.tlsConfig),
client.WithDialTimeout(prm.timeoutDial),
client.WithRWTimeout(prm.streamTimeout),
client.WithGRPCDialOptions(prm.dialOptions),
)...)
c.setFrostFSAPIServer((*coreServer)(&c.c))
@ -186,6 +188,8 @@ type PrmDial struct {
streamTimeoutSet bool
streamTimeout time.Duration
dialOptions []grpc.DialOption
}
// SetServerURI sets server URI in the FrostFS network.
@ -226,3 +230,8 @@ func (x *PrmDial) SetStreamTimeout(timeout time.Duration) {
x.streamTimeoutSet = true
x.streamTimeout = timeout
}
// SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection.
func (x *PrmDial) SetGRPCDialOptions(opts ...grpc.DialOption) {
x.dialOptions = opts
}