[#131] client: keep backwards-compatibility, update README.md, fix chore
All checks were successful
DCO / DCO (pull_request) Successful in 1m0s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m11s
Tests and linters / Lint (pull_request) Successful in 3m49s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m9s

Signed-off-by: Egor Olefirenko <egor.olefirenko892@gmail.com>
This commit is contained in:
Egor Olefirenko 2023-09-15 21:31:02 +03:00
parent d241aa92bf
commit 070db1d2c7
3 changed files with 5 additions and 3 deletions

View file

@ -42,7 +42,6 @@ Contains client for working with FrostFS.
```go ```go
var prmInit client.PrmInit var prmInit client.PrmInit
prmInit.SetDefaultPrivateKey(key) // private key for request signing prmInit.SetDefaultPrivateKey(key) // private key for request signing
prmInit.DisableFrostFSFailuresResolution() // disable erroneous status parsing
var c client.Client var c client.Client
c.Init(prmInit) c.Init(prmInit)
@ -78,7 +77,6 @@ these details to the user as well as retry an operation, possibly with different
Status wire-format is extendable and each node can report any set of details it wants. Status wire-format is extendable and each node can report any set of details it wants.
The set of reserved status codes can be found in The set of reserved status codes can be found in
[FrostFS API](https://git.frostfs.info/TrueCloudLab/frostfs-api/src/branch/master/status/types.proto). [FrostFS API](https://git.frostfs.info/TrueCloudLab/frostfs-api/src/branch/master/status/types.proto).
Use `client.PrmInit.DisableFrostFSFailuresResolution()` to avoid returning erroneous statuses as Go built-in errors.
### policy ### policy
Contains helpers allowing conversion of placing policy from/to JSON representation Contains helpers allowing conversion of placing policy from/to JSON representation

View file

@ -161,6 +161,10 @@ func (x *PrmInit) SetDefaultPrivateKey(key ecdsa.PrivateKey) {
x.key = key x.key = key
} }
// Deprecated: method is no-op. Option is default.
func (x *PrmInit) ResolveFrostFSFailures() {
}
// DisableFrostFSFailuresResolution makes the Client to preserve failure statuses of the // DisableFrostFSFailuresResolution makes the Client to preserve failure statuses of the
// FrostFS protocol only in resulting structure (see corresponding Res* docs). // FrostFS protocol only in resulting structure (see corresponding Res* docs).
// These errors are returned from each protocol operation. By default, statuses // These errors are returned from each protocol operation. By default, statuses

View file

@ -67,6 +67,7 @@ func TestClient_NetMapSnapshot(t *testing.T) {
var res *ResNetMapSnapshot var res *ResNetMapSnapshot
var srv serverNetMap var srv serverNetMap
c := newClient(&srv) c := newClient(&srv)
c.prm.DisableFrostFSFailuresResolution()
ctx := context.Background() ctx := context.Background()
// request signature // request signature
@ -84,7 +85,6 @@ func TestClient_NetMapSnapshot(t *testing.T) {
srv.signResponse = true srv.signResponse = true
// status failure // status failure
c.prm.DisableFrostFSFailuresResolution()
res, err = c.NetMapSnapshot(ctx, prm) res, err = c.NetMapSnapshot(ctx, prm)
require.NoError(t, err) require.NoError(t, err)
assertStatusErr(t, res) assertStatusErr(t, res)