forked from TrueCloudLab/frostfs-node
[#210] policier: Resolve contextcheck linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
9098d0eec0
commit
23575e1ac0
15 changed files with 58 additions and 54 deletions
|
@ -1,6 +1,7 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
|
||||
|
@ -44,16 +45,16 @@ func (p *DeletePrm) WithForceRemoval() {
|
|||
// NOTE: Marks any object to be deleted (despite any prohibitions
|
||||
// on operations with that object) if WithForceRemoval option has
|
||||
// been provided.
|
||||
func (e *StorageEngine) Delete(prm DeletePrm) (res DeleteRes, err error) {
|
||||
func (e *StorageEngine) Delete(ctx context.Context, prm DeletePrm) (res DeleteRes, err error) {
|
||||
err = e.execIfNotBlocked(func() error {
|
||||
res, err = e.delete(prm)
|
||||
res, err = e.delete(ctx, prm)
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (e *StorageEngine) delete(prm DeletePrm) (DeleteRes, error) {
|
||||
func (e *StorageEngine) delete(ctx context.Context, prm DeletePrm) (DeleteRes, error) {
|
||||
if e.metrics != nil {
|
||||
defer elapsed(e.metrics.AddDeleteDuration)()
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ func (e *StorageEngine) delete(prm DeletePrm) (DeleteRes, error) {
|
|||
shPrm.ForceRemoval()
|
||||
}
|
||||
|
||||
_, err = sh.Inhume(shPrm)
|
||||
_, err = sh.Inhume(ctx, shPrm)
|
||||
if err != nil {
|
||||
e.reportShardError(sh, "could not inhume object in shard", err)
|
||||
|
||||
|
@ -113,13 +114,13 @@ func (e *StorageEngine) delete(prm DeletePrm) (DeleteRes, error) {
|
|||
}
|
||||
|
||||
if splitInfo != nil {
|
||||
e.deleteChildren(prm.addr, prm.forceRemoval, splitInfo.SplitID())
|
||||
e.deleteChildren(ctx, prm.addr, prm.forceRemoval, splitInfo.SplitID())
|
||||
}
|
||||
|
||||
return DeleteRes{}, nil
|
||||
}
|
||||
|
||||
func (e *StorageEngine) deleteChildren(addr oid.Address, force bool, splitID *objectSDK.SplitID) {
|
||||
func (e *StorageEngine) deleteChildren(ctx context.Context, addr oid.Address, force bool, splitID *objectSDK.SplitID) {
|
||||
var fs objectSDK.SearchFilters
|
||||
fs.AddSplitIDFilter(objectSDK.MatchStringEqual, splitID)
|
||||
|
||||
|
@ -144,7 +145,7 @@ func (e *StorageEngine) deleteChildren(addr oid.Address, force bool, splitID *ob
|
|||
for _, addr := range res.AddressList() {
|
||||
inhumePrm.MarkAsGarbage(addr)
|
||||
|
||||
_, err = sh.Inhume(inhumePrm)
|
||||
_, err = sh.Inhume(ctx, inhumePrm)
|
||||
if err != nil {
|
||||
e.log.Debug("could not inhume object in shard",
|
||||
zap.Stringer("addr", addr),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue