forked from TrueCloudLab/frostfs-node
[#1175] shard: Return status error on Inhume of locked object
Make `Shard.Inhume` to forward `apistatus.ObjectLocked` returned by underlying metabase. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
b585791d6e
commit
e21eedee06
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package shard
|
package shard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||||
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
|
addressSDK "github.com/nspcc-dev/neofs-sdk-go/object/address"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -44,6 +46,9 @@ func (p *InhumePrm) MarkAsGarbage(addr ...*addressSDK.Address) *InhumePrm {
|
||||||
// Inhume calls metabase. Inhume method to mark object as removed. It won't be
|
// Inhume calls metabase. Inhume method to mark object as removed. It won't be
|
||||||
// removed physically from blobStor and metabase until `Delete` operation.
|
// removed physically from blobStor and metabase until `Delete` operation.
|
||||||
//
|
//
|
||||||
|
// Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked
|
||||||
|
// if at least one object is locked.
|
||||||
|
//
|
||||||
// Returns ErrReadOnlyMode error if shard is in "read-only" mode.
|
// Returns ErrReadOnlyMode error if shard is in "read-only" mode.
|
||||||
func (s *Shard) Inhume(prm *InhumePrm) (*InhumeRes, error) {
|
func (s *Shard) Inhume(prm *InhumePrm) (*InhumeRes, error) {
|
||||||
if s.GetMode() == ModeReadOnly {
|
if s.GetMode() == ModeReadOnly {
|
||||||
|
@ -69,6 +74,8 @@ func (s *Shard) Inhume(prm *InhumePrm) (*InhumeRes, error) {
|
||||||
s.log.Debug("could not mark object to delete in metabase",
|
s.log.Debug("could not mark object to delete in metabase",
|
||||||
zap.String("error", err.Error()),
|
zap.String("error", err.Error()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("metabase inhume: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(InhumeRes), nil
|
return new(InhumeRes), nil
|
||||||
|
|
Loading…
Reference in a new issue