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
|
@ -60,16 +60,16 @@ var errInhumeFailure = errors.New("inhume operation failed")
|
|||
// with that object) if WithForceRemoval option has been provided.
|
||||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
func (e *StorageEngine) Inhume(prm InhumePrm) (res InhumeRes, err error) {
|
||||
func (e *StorageEngine) Inhume(ctx context.Context, prm InhumePrm) (res InhumeRes, err error) {
|
||||
err = e.execIfNotBlocked(func() error {
|
||||
res, err = e.inhume(prm)
|
||||
res, err = e.inhume(ctx, prm)
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
|
||||
func (e *StorageEngine) inhume(ctx context.Context, prm InhumePrm) (InhumeRes, error) {
|
||||
if e.metrics != nil {
|
||||
defer elapsed(e.metrics.AddInhumeDuration)()
|
||||
}
|
||||
|
@ -98,12 +98,12 @@ func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
|
|||
shPrm.MarkAsGarbage(prm.addrs[i])
|
||||
}
|
||||
|
||||
ok, err := e.inhumeAddr(prm.addrs[i], shPrm, true)
|
||||
ok, err := e.inhumeAddr(ctx, prm.addrs[i], shPrm, true)
|
||||
if err != nil {
|
||||
return InhumeRes{}, err
|
||||
}
|
||||
if !ok {
|
||||
ok, err := e.inhumeAddr(prm.addrs[i], shPrm, false)
|
||||
ok, err := e.inhumeAddr(ctx, prm.addrs[i], shPrm, false)
|
||||
if err != nil {
|
||||
return InhumeRes{}, err
|
||||
} else if !ok {
|
||||
|
@ -116,7 +116,7 @@ func (e *StorageEngine) inhume(prm InhumePrm) (InhumeRes, error) {
|
|||
}
|
||||
|
||||
// Returns ok if object was inhumed during this invocation or before.
|
||||
func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkExists bool) (bool, error) {
|
||||
func (e *StorageEngine) inhumeAddr(ctx context.Context, addr oid.Address, prm shard.InhumePrm, checkExists bool) (bool, error) {
|
||||
root := false
|
||||
var errLocked apistatus.ObjectLocked
|
||||
var existPrm shard.ExistsPrm
|
||||
|
@ -154,7 +154,7 @@ func (e *StorageEngine) inhumeAddr(addr oid.Address, prm shard.InhumePrm, checkE
|
|||
}
|
||||
}
|
||||
|
||||
_, err := sh.Inhume(prm)
|
||||
_, err := sh.Inhume(ctx, prm)
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.As(err, &errLocked):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue