forked from TrueCloudLab/frostfs-node
[#506] container: Use user.ID in DeletionInfo response
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
8088063195
commit
f04806ccd3
2 changed files with 10 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue