From 5e50ddd7f5abbc93d74a5cf542b1e6ffe762a7fe Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 13 May 2022 12:25:13 +0300 Subject: [PATCH] [#1389] storagegroup: Upgrade SDK package Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/storagegroup.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- pkg/core/object/fmt.go | 2 +- pkg/core/object/fmt_test.go | 3 +-- pkg/innerring/rpc.go | 4 ++-- pkg/services/object_manager/storagegroup/collect.go | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index 2d987fc1d..dc9f54fd3 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -248,7 +248,7 @@ func getSG(cmd *cobra.Command, _ []string) { _, err = internalclient.GetObject(prm) exitOnErr(cmd, errf("rpc error: %w", err)) - sg := storagegroupAPI.New() + var sg storagegroupAPI.StorageGroup err = sg.Unmarshal(buf.Bytes()) exitOnErr(cmd, errf("could not unmarshal storage group: %w", err)) diff --git a/go.mod b/go.mod index ac57806e5..a3daaeb04 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220321144137-d5a9af5860af // indirect github.com/nspcc-dev/neofs-api-go/v2 v2.12.1 github.com/nspcc-dev/neofs-contract v0.14.2 - github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413143225-1186f2f7035d + github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413153333-9b63c07c59eb github.com/nspcc-dev/tzhash v1.5.2 github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 diff --git a/go.sum b/go.sum index 2e05c0981..0000c3708 100644 --- a/go.sum +++ b/go.sum @@ -406,8 +406,8 @@ github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnB github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211201182451-a5b61c4f6477/go.mod h1:dfMtQWmBHYpl9Dez23TGtIUKiFvCIxUZq/CkSIhEpz4= github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659/go.mod h1:/jay1lr3w7NQd/VDBkEhkJmDmyPNsu4W+QV2obsUV40= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413143225-1186f2f7035d h1:/rIG/M1WXS8653D4pxXm1fYNTeG1rPTfFLh3D7esgZw= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413143225-1186f2f7035d/go.mod h1:cQKdlr9Gmp5jxbOJ78S714i1AycfYUzpVddxVUD48WM= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413153333-9b63c07c59eb h1:tpgXLYlApgL/IkdXGzPpvXH5PzoS8HpU/AjyE5/FMT4= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.3.0.20220413153333-9b63c07c59eb/go.mod h1:cQKdlr9Gmp5jxbOJ78S714i1AycfYUzpVddxVUD48WM= github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= 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= diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index 50beb04ac..2cc9c72d7 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -213,7 +213,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) error { return fmt.Errorf("(%T) empty payload in SG", v) } - sg := storagegroup.New() + var sg storagegroup.StorageGroup if err := sg.Unmarshal(o.Payload()); err != nil { return fmt.Errorf("(%T) could not unmarshal SG content: %w", v, err) diff --git a/pkg/core/object/fmt_test.go b/pkg/core/object/fmt_test.go index b0d0d1a21..930af3c67 100644 --- a/pkg/core/object/fmt_test.go +++ b/pkg/core/object/fmt_test.go @@ -154,8 +154,7 @@ func TestFormatValidator_Validate(t *testing.T) { require.Error(t, v.ValidateContent(obj)) - content := storagegroup.New() - content.SetMembers([]oidSDK.ID{}) + var content storagegroup.StorageGroup data, err := content.Marshal() require.NoError(t, err) diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index da89abe68..2d8d6d94c 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -113,14 +113,14 @@ func (c *ClientCache) getSG(ctx context.Context, addr *addressSDK.Address, nm *n continue } - sg := storagegroup.New() + var sg storagegroup.StorageGroup err = sg.Unmarshal(payload) if err != nil { return nil, fmt.Errorf("can't parse storage group payload: %w", err) } - return sg, nil + return &sg, nil } var errNotFound apistatus.ObjectNotFound diff --git a/pkg/services/object_manager/storagegroup/collect.go b/pkg/services/object_manager/storagegroup/collect.go index b480a9100..6232fc75b 100644 --- a/pkg/services/object_manager/storagegroup/collect.go +++ b/pkg/services/object_manager/storagegroup/collect.go @@ -21,7 +21,7 @@ func CollectMembers(r objutil.HeadReceiver, cnr *cid.ID, members []oidSDK.ID) (* phyMembers []oidSDK.ID phyHashes [][]byte addr = addressSDK.NewAddress() - sg = storagegroup.New() + sg storagegroup.StorageGroup ) addr.SetContainerID(*cnr) @@ -58,5 +58,5 @@ func CollectMembers(r objutil.HeadReceiver, cnr *cid.ID, members []oidSDK.ID) (* sg.SetValidationDataSize(sumPhySize) sg.SetValidationDataHash(cs) - return sg, nil + return &sg, nil }