diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index f393eb57..6a2d9d32 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -105,9 +105,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add return } - c := &processPlacementContext{ - Context: ctx, - } + c := &placementRequirements{} var numOfContainerNodes int for i := range nn { @@ -124,8 +122,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add default: } - //nolint: contextcheck - p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes) + p.processNodes(ctx, c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes) } if !c.needLocalCopy && c.removeLocalCopy { @@ -137,10 +134,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add } } -// nolint: containedctx -type processPlacementContext struct { - context.Context - +type placementRequirements struct { // needLocalCopy is true if the current node must store an object according to the storage policy. needLocalCopy bool // removeLocalCopy is true if all copies are stored according to the storage policy @@ -149,7 +143,7 @@ type processPlacementContext struct { } // nolint: funlen -func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType, +func (p *Policer) processNodes(ctx context.Context, requirements *placementRequirements, addrWithType objectcore.AddressWithType, nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) { addr := addrWithType.Address typ := addrWithType.Type @@ -189,7 +183,7 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType object } if p.netmapKeys.IsLocalKey(nodes[i].PublicKey()) { - ctx.needLocalCopy = true + requirements.needLocalCopy = true shortage-- } else if nodes[i].IsMaintenance() { @@ -253,7 +247,7 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType object zap.Int("count", uncheckedCopies)) } else if uncheckedCopies == 0 { // Safe to remove: checked all copies, shortage == 0. - ctx.removeLocalCopy = true + requirements.removeLocalCopy = true } }