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