From f04806ccd342be552cf172b4ebf856899fbc7a70 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 14 Nov 2023 14:21:58 +0300 Subject: [PATCH] [#506] container: Use user.ID in DeletionInfo response Signed-off-by: Evgenii Stratonikov --- pkg/core/container/storage.go | 3 ++- pkg/morph/client/container/deletion_info.go | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/core/container/storage.go b/pkg/core/container/storage.go index f48fc73ac..05e8fce49 100644 --- a/pkg/core/container/storage.go +++ b/pkg/core/container/storage.go @@ -6,6 +6,7 @@ import ( frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" policyengine "git.frostfs.info/TrueCloudLab/policy-engine" ) @@ -24,7 +25,7 @@ type Container struct { // DelInfo contains info about removed container. type DelInfo struct { // Container owner. - Owner []byte + Owner user.ID // Epoch indicates when the container was removed. Epoch int diff --git a/pkg/morph/client/container/deletion_info.go b/pkg/morph/client/container/deletion_info.go index 40eb267d6..61e26506d 100644 --- a/pkg/morph/client/container/deletion_info.go +++ b/pkg/morph/client/container/deletion_info.go @@ -10,6 +10,8 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" + "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" + "github.com/mr-tron/base58" ) func (x *containerSource) DeletionInfo(cnr cid.ID) (*containercore.DelInfo, error) { @@ -51,11 +53,16 @@ func (c *Client) DeletionInfo(cid []byte) (*containercore.DelInfo, error) { return nil, fmt.Errorf("unexpected container stack item count (%s): %d", deletionInfoMethod, len(arr)) } - owner, err := client.BytesFromStackItem(arr[0]) + rawOwner, err := client.BytesFromStackItem(arr[0]) if err != nil { return nil, fmt.Errorf("could not get byte array of container (%s): %w", deletionInfoMethod, err) } + var owner user.ID + if err := owner.DecodeString(base58.Encode(rawOwner)); err != nil { + return nil, fmt.Errorf("could not decode container owner id (%s): %w", deletionInfoMethod, err) + } + epoch, err := client.IntFromStackItem(arr[1]) if err != nil { return nil, fmt.Errorf("could not get byte array of container signature (%s): %w", deletionInfoMethod, err)