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 | Bin 98218 -> 98218 bytes pkg/core/object/fmt.go | 2 +- pkg/core/object/fmt_test.go | 3 +-- pkg/innerring/rpc.go | 4 ++-- .../object_manager/storagegroup/collect.go | 4 ++-- 7 files changed, 8 insertions(+), 9 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 2e05c0981526b4269231cf57ba98ffa325999e79..0000c370834487560b3d8066b9c0fc209f6cf8a7 100644 GIT binary patch delta 107 zcmZ4WpLNxL)(v}SJDM5;fv#nenQ^j#d9tZxYLY^Rp;bvidW278j$=W(kG^MiN`!k= uKtWlAhiO1nez1i{L8!iCR;8<{zMF4|$>fRCWhc*{EhmI&(q`{D@s9!T)g;{j delta 107 zcmZ4WpLNxL)(v}SJDM098JX%D8d{j88Ks#U7@MXjWEfiM7kRqt`x=Hv1Y4My8oQVj wR7B(&rbYUNq`Dgx1%#xz`D7Ton5Pz}N0m>WI9+z~{Mm9sm?mxZo)iBV0Cx5xBme*a 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 }