oracle: update NeoFS SDK to 1.0.0-rc.9

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-06-06 11:22:08 +03:00
parent b86975b061
commit 4b2fc32462
3 changed files with 23 additions and 36 deletions

6
go.mod
View file

@ -14,7 +14,7 @@ require (
github.com/nspcc-dev/dbft v0.0.0-20230515113611-25db6ba61d5c
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.8
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.9
github.com/nspcc-dev/rfc6979 v0.2.0
github.com/pierrec/lz4 v2.6.1+incompatible
github.com/pmezard/go-difflib v1.0.0
@ -49,7 +49,7 @@ require (
github.com/nspcc-dev/hrw v1.0.9 // indirect
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0 // indirect
github.com/nspcc-dev/neofs-crypto v0.4.0 // indirect
github.com/nspcc-dev/tzhash v1.6.1 // indirect
github.com/nspcc-dev/tzhash v1.7.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
@ -62,7 +62,7 @@ require (
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/sys v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect

13
go.sum
View file

@ -223,12 +223,12 @@ github.com/nspcc-dev/neofs-api-go/v2 v2.14.0 h1:jhuN8Ldqz7WApvUJRFY0bjRXE1R3iCkb
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0/go.mod h1:DRIr0Ic1s+6QgdqmNFNLIqMqd7lNMJfYwkczlm1hDtM=
github.com/nspcc-dev/neofs-crypto v0.4.0 h1:5LlrUAM5O0k1+sH/sktBtrgfWtq1pgpDs09fZo+KYi4=
github.com/nspcc-dev/neofs-crypto v0.4.0/go.mod h1:6XJ8kbXgOfevbI2WMruOtI+qUJXNwSGM/E9eClXxPHs=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.8 h1:bsg3o7Oiae2xHYAs1M5yg8GDOs46x/IW5jCh/4dt8uo=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.8/go.mod h1:kq/KoRhj/Ye8b7ctykiXej42Kq09lUg2E5FXGCbLOWs=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.9 h1:uIQlWUUo5n/e8rLFGm14zIValcpXU1HWuwaoXUAHt5Q=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.9/go.mod h1:fTsdTU/M9rvv/f9jlp7vHOm3DRp+NSfjfTv9NohrKTE=
github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
github.com/nspcc-dev/tzhash v1.6.1 h1:8dUrWFpjkmoHF+7GxuGUmarj9LLHWFcuyF3CTrqq9JE=
github.com/nspcc-dev/tzhash v1.6.1/go.mod h1:BoflzCVp+DO/f1mvbcsJQWoFzidIFBhWFZMglbUW648=
github.com/nspcc-dev/tzhash v1.7.0 h1:/+aL33NC7y5OIGnY2kYgjZt8mg7LVGFMdj/KAJLndnk=
github.com/nspcc-dev/tzhash v1.7.0/go.mod h1:Dnx9LUlOLr5paL2Rtc96x0PPs8D9eIkUtowt1n+KQus=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@ -468,8 +468,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
@ -635,7 +635,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View file

@ -53,11 +53,15 @@ func Get(ctx context.Context, priv *keys.PrivateKey, u *url.URL, addr string, re
return nil, err
}
var c = new(client.Client)
var prmi client.PrmInit
prmi.ResolveNeoFSFailures()
var (
prmi client.PrmInit
c *client.Client
)
prmi.SetDefaultSigner(neofsecdsa.Signer(priv.PrivateKey))
c.Init(prmi)
c, err = client.New(prmi)
if err != nil {
return nil, fmt.Errorf("failed to create client: %w", err)
}
var prmd client.PrmDial
prmd.SetServerURI(addr)
@ -109,11 +113,7 @@ func parseNeoFSURL(u *url.URL) (*oid.Address, []string, error) {
}
func getPayload(ctx context.Context, c *client.Client, addr *oid.Address, resReader ResultReader) ([]byte, error) {
var getPrm client.PrmObjectGet
getPrm.FromContainer(addr.Container())
getPrm.ByID(addr.Object())
objR, err := c.ObjectGetInit(ctx, getPrm)
objR, err := c.ObjectGetInit(ctx, addr.Container(), addr.Object(), client.PrmObjectGet{})
if err != nil {
return nil, err
}
@ -121,7 +121,7 @@ func getPayload(ctx context.Context, c *client.Client, addr *oid.Address, resRea
if err != nil {
return nil, err
}
_, err = objR.Close() // Using ResolveNeoFSFailures.
err = objR.Close()
if err != nil {
return nil, err
}
@ -137,13 +137,8 @@ func getRange(ctx context.Context, c *client.Client, addr *oid.Address, resReade
if err != nil {
return nil, err
}
var rangePrm client.PrmObjectRange
rangePrm.FromContainer(addr.Container())
rangePrm.ByID(addr.Object())
rangePrm.SetLength(r.GetLength())
rangePrm.SetOffset(r.GetOffset())
rangeR, err := c.ObjectRangeInit(ctx, rangePrm)
rangeR, err := c.ObjectRangeInit(ctx, addr.Container(), addr.Object(), r.GetOffset(), r.GetLength(), client.PrmObjectRange{})
if err != nil {
return nil, err
}
@ -151,7 +146,7 @@ func getRange(ctx context.Context, c *client.Client, addr *oid.Address, resReade
if err != nil {
return nil, err
}
_, err = rangeR.Close() // Using ResolveNeoFSFailures.
err = rangeR.Close()
if err != nil {
return nil, err
}
@ -160,11 +155,7 @@ func getRange(ctx context.Context, c *client.Client, addr *oid.Address, resReade
}
func getObjHeader(ctx context.Context, c *client.Client, addr *oid.Address) (*object.Object, error) {
var headPrm client.PrmObjectHead
headPrm.FromContainer(addr.Container())
headPrm.ByID(addr.Object())
res, err := c.ObjectHead(ctx, headPrm)
res, err := c.ObjectHead(ctx, addr.Container(), addr.Object(), client.PrmObjectHead{})
if err != nil {
return nil, err
}
@ -200,15 +191,12 @@ func getHash(ctx context.Context, c *client.Client, addr *oid.Address, ps ...str
return nil, err
}
var hashPrm client.PrmObjectHash
hashPrm.FromContainer(addr.Container())
hashPrm.ByID(addr.Object())
hashPrm.SetRangeList(r.GetOffset(), r.GetLength())
res, err := c.ObjectHash(ctx, hashPrm)
hashes, err := c.ObjectHash(ctx, addr.Container(), addr.Object(), hashPrm)
if err != nil {
return nil, err
}
hashes := res.Checksums() // Using ResolveNeoFSFailures.
if len(hashes) == 0 {
return nil, fmt.Errorf("%w: empty response", ErrInvalidRange)
}