forked from TrueCloudLab/frostfs-node
[#1147] node: Implement Lock\Delete
requests for EC object
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
88b8ddd902
commit
6130650bb6
20 changed files with 371 additions and 66 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue