From 0720d96c9dac7b407b1d5e1ab0392e8d2d4c39f8 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 22 Aug 2022 14:04:00 +0300 Subject: [PATCH] [#1687] go.mod: Update neofs-sdk-go Signed-off-by: Pavel Karpy --- cmd/neofs-cli/internal/client/client.go | 35 +++++------------- cmd/neofs-cli/modules/accounting/balance.go | 6 +-- cmd/neofs-cli/modules/container/get_eacl.go | 2 +- cmd/neofs-cli/modules/container/set_eacl.go | 3 +- go.mod | 2 +- go.sum | Bin 115916 -> 115816 bytes pkg/services/object/internal/client/client.go | 10 ++--- 7 files changed, 18 insertions(+), 40 deletions(-) diff --git a/cmd/neofs-cli/internal/client/client.go b/cmd/neofs-cli/internal/client/client.go index de16962ea..d64903b68 100644 --- a/cmd/neofs-cli/internal/client/client.go +++ b/cmd/neofs-cli/internal/client/client.go @@ -30,7 +30,7 @@ type BalanceOfRes struct { } // Balance returns the current balance. -func (x BalanceOfRes) Balance() *accounting.Decimal { +func (x BalanceOfRes) Balance() accounting.Decimal { return x.cliRes.Amount() } @@ -95,12 +95,7 @@ func (x PutContainerRes) ID() cid.ID { func PutContainer(prm PutContainerPrm) (res PutContainerRes, err error) { cliRes, err := prm.cli.ContainerPut(context.Background(), prm.PrmContainerPut) if err == nil { - cnr := cliRes.ID() - if cnr == nil { - err = errors.New("missing container ID in response") - } else { - res.cnr = *cnr - } + res.cnr = cliRes.ID() } return @@ -171,7 +166,7 @@ type EACLRes struct { } // EACL returns requested eACL table. -func (x EACLRes) EACL() *eacl.Table { +func (x EACLRes) EACL() eacl.Table { return x.cliRes.Table() } @@ -219,7 +214,7 @@ type NetworkInfoRes struct { } // NetworkInfo returns structured information about the NeoFS network. -func (x NetworkInfoRes) NetworkInfo() *netmap.NetworkInfo { +func (x NetworkInfoRes) NetworkInfo() netmap.NetworkInfo { return x.cliRes.Info() } @@ -245,11 +240,11 @@ type NodeInfoRes struct { // NodeInfo returns information about the node from netmap. func (x NodeInfoRes) NodeInfo() netmap.NodeInfo { - return *x.cliRes.NodeInfo() + return x.cliRes.NodeInfo() } // LatestVersion returns the latest NeoFS API version in use. -func (x NodeInfoRes) LatestVersion() *version.Version { +func (x NodeInfoRes) LatestVersion() version.Version { return x.cliRes.LatestVersion() } @@ -406,13 +401,9 @@ func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { return nil, fmt.Errorf("client failure: %w", err) } - var res PutObjectRes - - if !cliRes.ReadStoredObjectID(&res.id) { - return nil, errors.New("missing ID of the stored object") - } - - return &res, nil + return &PutObjectRes{ + id: cliRes.StoredObjectID(), + }, nil } // DeleteObjectPrm groups parameters of DeleteObject operation. @@ -454,14 +445,8 @@ func DeleteObject(prm DeleteObjectPrm) (*DeleteObjectRes, error) { return nil, fmt.Errorf("remove object via client: %w", err) } - var id oid.ID - - if !cliRes.ReadTombstoneID(&id) { - return nil, errors.New("object removed but tombstone ID is missing") - } - return &DeleteObjectRes{ - tomb: id, + tomb: cliRes.Tombstone(), }, nil } diff --git a/cmd/neofs-cli/modules/accounting/balance.go b/cmd/neofs-cli/modules/accounting/balance.go index 583b2b4b4..2864d0fcb 100644 --- a/cmd/neofs-cli/modules/accounting/balance.go +++ b/cmd/neofs-cli/modules/accounting/balance.go @@ -58,11 +58,7 @@ func initAccountingBalanceCmd() { ff.String(ownerFlag, "", "owner of balance account (omit to use owner from private key)") } -func prettyPrintDecimal(cmd *cobra.Command, decimal *accounting.Decimal) { - if decimal == nil { - return - } - +func prettyPrintDecimal(cmd *cobra.Command, decimal accounting.Decimal) { if viper.GetBool(commonflags.Verbose) { cmd.Println("value:", decimal.Value()) cmd.Println("precision:", decimal.Precision()) diff --git a/cmd/neofs-cli/modules/container/get_eacl.go b/cmd/neofs-cli/modules/container/get_eacl.go index d1a5d9894..23ee36a51 100644 --- a/cmd/neofs-cli/modules/container/get_eacl.go +++ b/cmd/neofs-cli/modules/container/get_eacl.go @@ -30,7 +30,7 @@ var getExtendedACLCmd = &cobra.Command{ if containerPathTo == "" { cmd.Println("eACL: ") - common.PrettyPrintJSON(cmd, eaclTable, "eACL") + common.PrettyPrintJSON(cmd, &eaclTable, "eACL") return } diff --git a/cmd/neofs-cli/modules/container/set_eacl.go b/cmd/neofs-cli/modules/container/set_eacl.go index 89e8ea6c3..4bb82b9cf 100644 --- a/cmd/neofs-cli/modules/container/set_eacl.go +++ b/cmd/neofs-cli/modules/container/set_eacl.go @@ -63,7 +63,8 @@ Container ID in EACL table will be substituted with ID from the CLI.`, res, err := internalclient.EACL(getEACLPrm) if err == nil { // compare binary values because EACL could have been set already - got, err := res.EACL().Marshal() + table := res.EACL() + got, err := table.Marshal() if err != nil { continue } diff --git a/go.mod b/go.mod index f88396dcf..6910b70bd 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220727202624-6c7a401f776a // indirect github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20220818094951-98db3fa28419 github.com/nspcc-dev/neofs-contract v0.15.3 - github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220801165707-7a99cc916c8e + github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20220822101910-7578b54fac3f github.com/nspcc-dev/tzhash v1.6.1 github.com/panjf2000/ants/v2 v2.4.0 github.com/paulmach/orb v0.2.2 diff --git a/go.sum b/go.sum index 73a0ba982a4441caf219312587a664e08ad39b8c..fcd29357780dd48058475507dd8dda335a56d3df 100644 GIT binary patch delta 180 zcmX@p$^N2)eS_}m$vkW1H*Z*7$>L&UWN2V$X=tEpZfb6kWNMO@m~5P;kYQ*QQDtsv zmYnaN9_5vq7U+~`o}8YMZCM!U9ck zr-00J3Jj>IG%EHF4GK;Lni-Z?R37P)m>y8#?P=^`=v<{9 delta 242 zcmaFS!G5NbeS_|5b3^^~e7)TK6om{!D|6#41Ivg+b5EnHz$9N|59cyRk31KTfXK|u z@H|(KM8g!bD6=3JUnif?$%5-;H_NVG!QyOSXlQ0?ZeXr!o@i;AoNQ@mmTZv6vf(0$$qE}3y|9{v z8!T^R^Pxb%+ diff --git a/pkg/services/object/internal/client/client.go b/pkg/services/object/internal/client/client.go index 87bc99794..f7cd14de5 100644 --- a/pkg/services/object/internal/client/client.go +++ b/pkg/services/object/internal/client/client.go @@ -408,13 +408,9 @@ func PutObject(prm PutObjectPrm) (*PutObjectRes, error) { return nil, fmt.Errorf("write object via client: %w", err) } - var res PutObjectRes - - if !cliRes.ReadStoredObjectID(&res.id) { - return nil, errors.New("missing identifier in the response") - } - - return &res, nil + return &PutObjectRes{ + id: cliRes.StoredObjectID(), + }, nil } // SearchObjectsPrm groups parameters of SearchObjects operation.