diff --git a/pkg/local_object_storage/engine/inhume.go b/pkg/local_object_storage/engine/inhume.go index a2dc130c..487e1a31 100644 --- a/pkg/local_object_storage/engine/inhume.go +++ b/pkg/local_object_storage/engine/inhume.go @@ -22,6 +22,7 @@ type InhumeRes struct{} // as the reason for inhume operation. // // tombstone should not be nil, addr should not be empty. +// Should not be called along with MarkAsGarbage. func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK.Address) *InhumePrm { if p != nil { p.addrs = addrs @@ -31,6 +32,18 @@ func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK return p } +// MarkAsGarbage marks object to be physically removed from local storage. +// +// Should not be called along with WithTarget. +func (p *InhumePrm) MarkAsGarbage(addrs ...*objectSDK.Address) *InhumePrm { + if p != nil { + p.addrs = addrs + p.tombstone = nil + } + + return p +} + var errInhumeFailure = errors.New("inhume operation failed") // Inhume calls metabase. Inhume method to mark object as removed. It won't be @@ -39,7 +52,11 @@ func (e *StorageEngine) Inhume(prm *InhumePrm) (*InhumeRes, error) { shPrm := new(shard.InhumePrm) for i := range prm.addrs { - shPrm.WithTarget(prm.tombstone, prm.addrs[i]) + if prm.tombstone != nil { + shPrm.WithTarget(prm.tombstone, prm.addrs[i]) + } else { + shPrm.MarkAsGarbage(prm.addrs[i]) + } ok := e.inhume(prm.addrs[i], shPrm, true) if ok {