diff --git a/pkg/innerring/rpc.go b/pkg/innerring/rpc.go index 665e94232d..c58e0ddc4e 100644 --- a/pkg/innerring/rpc.go +++ b/pkg/innerring/rpc.go @@ -131,7 +131,7 @@ func (c *ClientCache) getSG(ctx context.Context, addr oid.Address, nm *netmap.Ne } // GetHeader requests node from the container under audit to return object header by id. -func (c *ClientCache) GetHeader(prm auditor.GetHeaderPrm) (*object.Object, error) { +func (c *ClientCache) GetHeader(ctx context.Context, prm auditor.GetHeaderPrm) (*object.Object, error) { var objAddress oid.Address objAddress.SetContainer(prm.CID) objAddress.SetObject(prm.OID) @@ -148,7 +148,7 @@ func (c *ClientCache) GetHeader(prm auditor.GetHeaderPrm) (*object.Object, error return nil, fmt.Errorf("can't setup remote connection with %s: %w", info.AddressGroup(), err) } - cctx, cancel := context.WithTimeout(prm.Context, c.headTimeout) + cctx, cancel := context.WithTimeout(ctx, c.headTimeout) var obj *object.Object @@ -169,7 +169,7 @@ func (c *ClientCache) GetHeader(prm auditor.GetHeaderPrm) (*object.Object, error // GetRangeHash requests node from the container under audit to return Tillich-Zemor hash of the // payload range of the object with specified identifier. -func (c *ClientCache) GetRangeHash(prm auditor.GetRangeHashPrm) ([]byte, error) { +func (c *ClientCache) GetRangeHash(ctx context.Context, prm auditor.GetRangeHashPrm) ([]byte, error) { var objAddress oid.Address objAddress.SetContainer(prm.CID) objAddress.SetObject(prm.OID) @@ -186,7 +186,7 @@ func (c *ClientCache) GetRangeHash(prm auditor.GetRangeHashPrm) ([]byte, error) return nil, fmt.Errorf("can't setup remote connection with %s: %w", info.AddressGroup(), err) } - cctx, cancel := context.WithTimeout(prm.Context, c.rangeTimeout) + cctx, cancel := context.WithTimeout(ctx, c.rangeTimeout) h, err := frostfsapiclient.HashObjectRange(cctx, cli, objAddress, prm.Range) diff --git a/pkg/services/audit/auditor/context.go b/pkg/services/audit/auditor/context.go index 4a5cbb457d..f2778fd656 100644 --- a/pkg/services/audit/auditor/context.go +++ b/pkg/services/audit/auditor/context.go @@ -81,10 +81,7 @@ type ContextPrm struct { pdpWorkerPool, porWorkerPool util.WorkerPool } -// nolint: containedctx type commonCommunicatorPrm struct { - Context context.Context - Node netmap.NodeInfo OID oid.ID @@ -109,11 +106,11 @@ type GetRangeHashPrm struct { // component of communication with container nodes. type ContainerCommunicator interface { // GetHeader must return object header from the container node. - GetHeader(GetHeaderPrm) (*object.Object, error) + GetHeader(context.Context, GetHeaderPrm) (*object.Object, error) // GetRangeHash must return homomorphic Tillich-Zemor hash of payload range of the // object stored in container node. - GetRangeHash(GetRangeHashPrm) ([]byte, error) + GetRangeHash(context.Context, GetRangeHashPrm) ([]byte, error) } // NewContext creates, initializes and returns Context. diff --git a/pkg/services/audit/auditor/pdp.go b/pkg/services/audit/auditor/pdp.go index beb2fdcf88..13b50e498d 100644 --- a/pkg/services/audit/auditor/pdp.go +++ b/pkg/services/audit/auditor/pdp.go @@ -118,7 +118,6 @@ func (c *Context) collectHashes(p *gamePair) { rand.Shuffle(len(order), func(i, j int) { order[i], order[j] = order[j], order[i] }) var getRangeHashPrm GetRangeHashPrm - getRangeHashPrm.Context = c.task.AuditContext() getRangeHashPrm.CID = c.task.ContainerID() getRangeHashPrm.OID = p.id getRangeHashPrm.Node = n @@ -138,7 +137,7 @@ func (c *Context) collectHashes(p *gamePair) { getRangeHashPrm.Range = rngs[i] - h, err := c.cnrCom.GetRangeHash(getRangeHashPrm) + h, err := c.cnrCom.GetRangeHash(c.task.AuditContext(), getRangeHashPrm) if err != nil { c.log.Debug("could not get payload range hash", zap.Stringer("id", p.id), diff --git a/pkg/services/audit/auditor/pop.go b/pkg/services/audit/auditor/pop.go index f8a16cb0a4..45afa7937e 100644 --- a/pkg/services/audit/auditor/pop.go +++ b/pkg/services/audit/auditor/pop.go @@ -49,7 +49,6 @@ func (c *Context) processObjectPlacement(id oid.ID, nodes []netmap.NodeInfo, rep ) var getHeaderPrm GetHeaderPrm - getHeaderPrm.Context = c.task.AuditContext() getHeaderPrm.OID = id getHeaderPrm.CID = c.task.ContainerID() getHeaderPrm.NodeIsRelay = false @@ -58,7 +57,7 @@ func (c *Context) processObjectPlacement(id oid.ID, nodes []netmap.NodeInfo, rep getHeaderPrm.Node = nodes[i] // try to get object header from node - hdr, err := c.cnrCom.GetHeader(getHeaderPrm) + hdr, err := c.cnrCom.GetHeader(c.task.AuditContext(), getHeaderPrm) if err != nil { c.log.Debug("could not get object header from candidate", zap.Stringer("id", id), diff --git a/pkg/services/audit/auditor/por.go b/pkg/services/audit/auditor/por.go index 1922213e56..ff322d6e19 100644 --- a/pkg/services/audit/auditor/por.go +++ b/pkg/services/audit/auditor/por.go @@ -48,7 +48,6 @@ func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGr ) var getHeaderPrm GetHeaderPrm - getHeaderPrm.Context = c.task.AuditContext() getHeaderPrm.CID = c.task.ContainerID() getHeaderPrm.NodeIsRelay = true @@ -81,7 +80,7 @@ func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGr getHeaderPrm.Node = flat[j] - hdr, err := c.cnrCom.GetHeader(getHeaderPrm) + hdr, err := c.cnrCom.GetHeader(c.task.AuditContext(), getHeaderPrm) if err != nil { c.log.Debug("can't head object", zap.String("remote_node", netmap.StringifyPublicKey(flat[j])),