forked from TrueCloudLab/xk6-frostfs
[#64] registry: Delete object from the old bucket
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
52ed0d6d88
commit
4aa9a359b5
1 changed files with 5 additions and 1 deletions
|
@ -81,10 +81,14 @@ func (o *ObjRegistry) SetObjectStatus(id uint64, oldStatus, newStatus string) er
|
||||||
return fmt.Errorf("bucket doesn't exist: '%s'", oldStatus)
|
return fmt.Errorf("bucket doesn't exist: '%s'", oldStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
objBytes := oldB.Get(encodeId(id))
|
key := encodeId(id)
|
||||||
|
objBytes := oldB.Get(key)
|
||||||
if objBytes == nil {
|
if objBytes == nil {
|
||||||
return errors.New("object doesn't exist")
|
return errors.New("object doesn't exist")
|
||||||
}
|
}
|
||||||
|
if err := oldB.Delete(key); err != nil {
|
||||||
|
return fmt.Errorf("bucket.Delete: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
obj := new(ObjectInfo)
|
obj := new(ObjectInfo)
|
||||||
if err := obj.Unmarshal(objBytes); err != nil {
|
if err := obj.Unmarshal(objBytes); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue