From 558cc1193aa0eed6b7f6d5171faffe8d29a8d618 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 7 Jul 2022 15:33:27 +0300 Subject: [PATCH] [#1461] engine: Clarify force removal Document force removal behaviour in all the Storage engine parts. Signed-off-by: Pavel Karpy --- pkg/local_object_storage/engine/delete.go | 4 ++++ pkg/local_object_storage/engine/inhume.go | 3 +++ pkg/local_object_storage/metabase/inhume.go | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/local_object_storage/engine/delete.go b/pkg/local_object_storage/engine/delete.go index 5b1ccc370..a8e0c27a5 100644 --- a/pkg/local_object_storage/engine/delete.go +++ b/pkg/local_object_storage/engine/delete.go @@ -42,6 +42,10 @@ func (p *DeletePrm) WithForceRemoval() { // // Returns apistatus.ObjectLocked if at least one object is locked. // In this case no object from the list is marked to be deleted. +// +// 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) { err = e.execIfNotBlocked(func() error { res, err = e.delete(prm) diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go index 20ec7ec7d..c333bdfcf 100644 --- a/pkg/local_object_storage/engine/inhume.go +++ b/pkg/local_object_storage/engine/inhume.go @@ -61,6 +61,9 @@ var errInhumeFailure = errors.New("inhume operation failed") // Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked // if at least one object is locked. // +// NOTE: Marks any object as removed (despite any prohibitions on operations +// 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) { err = e.execIfNotBlocked(func() error { diff --git a/pkg/local_object_storage/metabase/inhume.go b/pkg/local_object_storage/metabase/inhume.go index 81140ee25..d5049bdce 100644 --- a/pkg/local_object_storage/metabase/inhume.go +++ b/pkg/local_object_storage/metabase/inhume.go @@ -100,7 +100,11 @@ var ErrLockObjectRemoval = errors.New("lock object removal") // Inhume marks objects as removed but not removes it from metabase. // // Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked -// if at least one object is locked. +// if at least one object is locked. Returns ErrLockObjectRemoval if inhuming +// is being performed on lock (not locked) object. +// +// NOTE: Marks any object with GC mark (despite any prohibitions on operations +// with that object) if WithForceGCMark option has been provided. func (db *DB) Inhume(prm InhumePrm) (res InhumeRes, err error) { err = db.boltDB.Update(func(tx *bbolt.Tx) error { garbageBKT := tx.Bucket(garbageBucketName)