Invalidate list cache on container events #802

Merged
fyrchik merged 4 commits from fyrchik/frostfs-node:remove-invalidate-cache into master 2023-11-14 19:00:13 +00:00
2 changed files with 10 additions and 2 deletions
Showing only changes of commit 5f01dffd45 - Show all commits

View file

@ -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

View file

@ -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)