forked from TrueCloudLab/frostfs-node
[#222] auditsvc: Resolve containedctx linter
Resolve containedctx linter for commonCommunicatorPrm type. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
fe87735073
commit
3dbff0a478
5 changed files with 9 additions and 15 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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])),
|
||||
|
|
Loading…
Reference in a new issue