[#506] container: Use user.ID in DeletionInfo response

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-11-14 14:21:58 +03:00 committed by Evgenii Stratonikov
parent 8088063195
commit f04806ccd3
2 changed files with 10 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import (
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
policyengine "git.frostfs.info/TrueCloudLab/policy-engine" policyengine "git.frostfs.info/TrueCloudLab/policy-engine"
) )
@ -24,7 +25,7 @@ type Container struct {
// DelInfo contains info about removed container. // DelInfo contains info about removed container.
type DelInfo struct { type DelInfo struct {
// Container owner. // Container owner.
Owner []byte Owner user.ID
// Epoch indicates when the container was removed. // Epoch indicates when the container was removed.
Epoch int Epoch int

View file

@ -10,6 +10,8 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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) { 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)) 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 { if err != nil {
return nil, fmt.Errorf("could not get byte array of container (%s): %w", deletionInfoMethod, err) 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]) epoch, err := client.IntFromStackItem(arr[1])
if err != nil { if err != nil {
return nil, fmt.Errorf("could not get byte array of container signature (%s): %w", deletionInfoMethod, err) return nil, fmt.Errorf("could not get byte array of container signature (%s): %w", deletionInfoMethod, err)