[#1147] node: Implement Lock\Delete requests for EC object

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-05-27 22:07:43 +03:00 committed by Evgenii Stratonikov
parent 88b8ddd902
commit 6130650bb6
20 changed files with 371 additions and 66 deletions

View file

@ -11,11 +11,13 @@ import (
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
)
func (e *StorageEngine) exists(ctx context.Context, addr oid.Address) (bool, error) {
func (e *StorageEngine) exists(ctx context.Context, addr oid.Address, parentAddr oid.Address) (bool, bool, error) {
var shPrm shard.ExistsPrm
shPrm.SetAddress(addr)
shPrm.SetParentAddress(parentAddr)
alreadyRemoved := false
exists := false
locked := false
e.iterateOverSortedShards(addr, func(_ int, sh hashedShard) (stop bool) {
res, err := sh.Exists(ctx, shPrm)
@ -44,13 +46,16 @@ func (e *StorageEngine) exists(ctx context.Context, addr oid.Address) (bool, err
if !exists {
exists = res.Exists()
}
if !locked {
locked = res.Locked()
}
return false
})
if alreadyRemoved {
return false, new(apistatus.ObjectAlreadyRemoved)
return false, false, new(apistatus.ObjectAlreadyRemoved)
}
return exists, nil
return exists, locked, nil
}