[#1555] engine: Refactor (*StorageEngine).GetLocks

Refactored after renaming the method to replace the confusing `locked`
variable with `locks`.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-12-11 14:47:18 +03:00
parent 72470d6b48
commit 3821645085
Signed by: a-savchuk
GPG key ID: 70C0A7FF6F9C4639

View file

@ -262,23 +262,23 @@ func (e *StorageEngine) GetLocks(ctx context.Context, addr oid.Address) ([]oid.I
))
defer span.End()
var locked []oid.ID
var allLocks []oid.ID
var outErr error
e.iterateOverUnsortedShards(func(h hashedShard) (stop bool) {
ld, err := h.Shard.GetLocks(ctx, addr)
locks, err := h.Shard.GetLocks(ctx, addr)
if err != nil {
e.reportShardError(ctx, h, logs.EngineInterruptGettingLockers, err, zap.Stringer("address", addr),
zap.String("trace_id", tracingPkg.GetTraceID(ctx)))
outErr = err
}
locked = append(locked, ld...)
allLocks = append(allLocks, locks...)
return false
})
if len(locked) > 0 {
return locked, nil
if len(allLocks) > 0 {
return allLocks, nil
}
return locked, outErr
return allLocks, outErr
}
func (e *StorageEngine) processExpiredTombstones(ctx context.Context, addrs []meta.TombstonedObject) {