forked from TrueCloudLab/frostfs-sdk-go
[#82] client: Allow to pass gRPC dial options
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
f5b23eb225
commit
10482ffbed
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
v2accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
|
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"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client represents virtual connection to the FrostFS network to communicate
|
// 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.WithNetworkURIAddress(prm.endpoint, prm.tlsConfig),
|
||||||
client.WithDialTimeout(prm.timeoutDial),
|
client.WithDialTimeout(prm.timeoutDial),
|
||||||
client.WithRWTimeout(prm.streamTimeout),
|
client.WithRWTimeout(prm.streamTimeout),
|
||||||
|
client.WithGRPCDialOptions(prm.dialOptions),
|
||||||
)...)
|
)...)
|
||||||
|
|
||||||
c.setFrostFSAPIServer((*coreServer)(&c.c))
|
c.setFrostFSAPIServer((*coreServer)(&c.c))
|
||||||
|
@ -186,6 +188,8 @@ type PrmDial struct {
|
||||||
|
|
||||||
streamTimeoutSet bool
|
streamTimeoutSet bool
|
||||||
streamTimeout time.Duration
|
streamTimeout time.Duration
|
||||||
|
|
||||||
|
dialOptions []grpc.DialOption
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetServerURI sets server URI in the FrostFS network.
|
// SetServerURI sets server URI in the FrostFS network.
|
||||||
|
@ -226,3 +230,8 @@ func (x *PrmDial) SetStreamTimeout(timeout time.Duration) {
|
||||||
x.streamTimeoutSet = true
|
x.streamTimeoutSet = true
|
||||||
x.streamTimeout = timeout
|
x.streamTimeout = timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetGRPCDialOptions sets the gRPC dial options for new gRPC client connection.
|
||||||
|
func (x *PrmDial) SetGRPCDialOptions(opts ...grpc.DialOption) {
|
||||||
|
x.dialOptions = opts
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue