[#1461] engine: Clarify force removal

Document force removal behaviour in all the Storage engine parts.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
remotes/fyrchik/tree-errors
Pavel Karpy 2022-07-07 15:33:27 +03:00 committed by fyrchik
parent b1e54dec9f
commit 558cc1193a
3 changed files with 12 additions and 1 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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)