forked from TrueCloudLab/frostfs-node
[#128] metabase: Implement Delete method
Implement Delete method on DB structure that adds deleted addresses to tombstone index. Do not attach addresses from tombstone index to Select result. Return error from Get method if address is presented in tombstone index. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2d319aa29c
commit
20ed7c0d61
4 changed files with 105 additions and 9 deletions
|
@ -15,12 +15,19 @@ func (db *DB) Get(addr *objectSDK.Address) (*object.Object, error) {
|
|||
var obj *object.Object
|
||||
|
||||
if err := db.boltDB.View(func(tx *bbolt.Tx) error {
|
||||
addrKey := addressKey(addr)
|
||||
|
||||
// check if object marked as deleted
|
||||
if objectRemoved(tx, addrKey) {
|
||||
return errNotFound
|
||||
}
|
||||
|
||||
primaryBucket := tx.Bucket(primaryBucket)
|
||||
if primaryBucket == nil {
|
||||
return errNotFound
|
||||
}
|
||||
|
||||
data := primaryBucket.Get(addressKey(addr))
|
||||
data := primaryBucket.Get(addrKey)
|
||||
if data == nil {
|
||||
return errNotFound
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue