Compare commits
3 commits
master
...
correct-de
Author | SHA1 | Date | |
---|---|---|---|
7404838a83 | |||
a8824fed89 | |||
71f9abaf4b |
3 changed files with 26 additions and 21 deletions
|
@ -96,6 +96,7 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error {
|
||||||
client.WithDialTimeout(prm.DialTimeout),
|
client.WithDialTimeout(prm.DialTimeout),
|
||||||
client.WithRWTimeout(prm.StreamTimeout),
|
client.WithRWTimeout(prm.StreamTimeout),
|
||||||
client.WithGRPCDialOptions(prm.GRPCDialOptions),
|
client.WithGRPCDialOptions(prm.GRPCDialOptions),
|
||||||
|
client.WithGRPCCallOptions(prm.GRPCCallOptions),
|
||||||
)...)
|
)...)
|
||||||
|
|
||||||
c.setFrostFSAPIServer((*coreServer)(&c.c))
|
c.setFrostFSAPIServer((*coreServer)(&c.c))
|
||||||
|
@ -105,27 +106,29 @@ func (c *Client) Dial(ctx context.Context, prm PrmDial) error {
|
||||||
_, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest),
|
_, err := rpc.Balance(&c.c, new(v2accounting.BalanceRequest),
|
||||||
client.WithContext(ctx),
|
client.WithContext(ctx),
|
||||||
)
|
)
|
||||||
if err != nil {
|
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var ctxErr error
|
var ctxErr error
|
||||||
|
|
||||||
// return context errors since they signal about dial problem
|
switch st, ok := status.FromError(err); {
|
||||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
case errors.Is(err, context.Canceled) || (ok && st.Code() == codes.Canceled):
|
||||||
ctxErr = err
|
|
||||||
} else if st, ok := status.FromError(err); ok && st.Code() == codes.Canceled {
|
|
||||||
ctxErr = context.Canceled
|
ctxErr = context.Canceled
|
||||||
} else if ok && st.Code() == codes.DeadlineExceeded {
|
case errors.Is(err, context.DeadlineExceeded) || (ok && st.Code() == codes.DeadlineExceeded):
|
||||||
ctxErr = context.DeadlineExceeded
|
ctxErr = context.DeadlineExceeded
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctxErr == nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
if ctxErr != nil {
|
|
||||||
if conn := c.c.Conn(); conn != nil {
|
if conn := c.c.Conn(); conn != nil {
|
||||||
_ = conn.Close()
|
_ = conn.Close()
|
||||||
}
|
}
|
||||||
return ctxErr
|
return ctxErr
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets underlying provider of frostFSAPIServer. The method is used for testing as an approach
|
// sets underlying provider of frostFSAPIServer. The method is used for testing as an approach
|
||||||
// to skip Dial stage and override FrostFS API server. MUST NOT be used outside test code.
|
// to skip Dial stage and override FrostFS API server. MUST NOT be used outside test code.
|
||||||
|
@ -213,6 +216,7 @@ type PrmDial struct {
|
||||||
StreamTimeout time.Duration
|
StreamTimeout time.Duration
|
||||||
|
|
||||||
GRPCDialOptions []grpc.DialOption
|
GRPCDialOptions []grpc.DialOption
|
||||||
|
GRPCCallOptions []grpc.CallOption
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetServerURI sets server URI in the FrostFS network.
|
// SetServerURI sets server URI in the FrostFS network.
|
||||||
|
|
3
go.mod
3
go.mod
|
@ -2,6 +2,9 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
|
// Just for testing
|
||||||
|
replace git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 => git.frostfs.info/a-savchuk/frostfs-api-go/v2 v2.16.1-0.20241016150118-3893ca67ac0c
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -1,7 +1,3 @@
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241002064811-3e705a3cbe84 h1:enycv8Uaji5Ic1+hk+F4BpYOQKV5U5t8A9CV8AmU2+M=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241002064811-3e705a3cbe84/go.mod h1:F5GS7hRb62PUy5sTYDC4ajVdeffoAfjHSSHTKUJEaYU=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1 h1:ivcdxQeQDnx4srF2ezoaeVlF0FAycSAztwfIUJnUI4s=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1/go.mod h1:F5GS7hRb62PUy5sTYDC4ajVdeffoAfjHSSHTKUJEaYU=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e h1:kcBqZBiFIUBATUqEuvVigtkJJWQ2Gug/eYXn967o3M4=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.19.3-0.20240621131249-49e5270f673e/go.mod h1:F/fe1OoIDKr5Bz99q4sriuHDuf3aZefZy9ZsCqEtgxc=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
||||||
|
@ -12,6 +8,8 @@ git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9m
|
||||||
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
|
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
|
||||||
git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA=
|
git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA=
|
||||||
git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8=
|
git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8=
|
||||||
|
git.frostfs.info/a-savchuk/frostfs-api-go/v2 v2.16.1-0.20241016150118-3893ca67ac0c h1:7k60i9BwSYSQHsiXHe6Ha0W49+4uDok/vqYc6OQ7EKA=
|
||||||
|
git.frostfs.info/a-savchuk/frostfs-api-go/v2 v2.16.1-0.20241016150118-3893ca67ac0c/go.mod h1:F5GS7hRb62PUy5sTYDC4ajVdeffoAfjHSSHTKUJEaYU=
|
||||||
github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc=
|
github.com/VictoriaMetrics/easyproto v0.1.4 h1:r8cNvo8o6sR4QShBXQd1bKw/VVLSQma/V2KhTBPf+Sc=
|
||||||
github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710=
|
github.com/VictoriaMetrics/easyproto v0.1.4/go.mod h1:QlGlzaJnDfFd8Lk6Ci/fuLxfTo3/GThPs2KH23mv710=
|
||||||
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
|
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
|
||||||
|
|
Loading…
Reference in a new issue