frostfs-node/pkg/local_object_storage/metabase/v2/inhume.go
Alex Vanin e478c0d024 [#199] Refactor metabase internal structure
Accoring to MetaBase-Plan-B storage engine specification.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-11 17:19:37 +03:00

19 lines
527 B
Go

package meta
import (
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"go.etcd.io/bbolt"
)
// Inhume marks objects as removed but not removes it from metabase.
func (db *DB) Inhume(target, tombstone *objectSDK.Address) error {
return db.boltDB.Update(func(tx *bbolt.Tx) error {
graveyard, err := tx.CreateBucketIfNotExists(graveyardBucketName)
if err != nil {
return err
}
// consider checking if target is already in graveyard?
return graveyard.Put(addressKey(target), addressKey(tombstone))
})
}