Commit 36feaa4b authored by Jeromy's avatar Jeromy

fix delete logic

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 62d23c06
......@@ -89,16 +89,21 @@ func (f *Filestore) DeleteBlock(c *cid.Cid) error {
return err1
}
if err2 := f.fm.DeleteBlock(c); err2 != nil {
// if we successfully removed something from the blockstore, but the
// filestore didnt have it, return success
if err1 == nil && err2 != blockstore.ErrNotFound {
return nil
err2 := f.fm.DeleteBlock(c)
// if we successfully removed something from the blockstore, but the
// filestore didnt have it, return success
switch err2 {
case nil:
return nil
case blockstore.ErrNotFound:
if err1 == blockstore.ErrNotFound {
return blockstore.ErrNotFound
}
return nil
default:
return err2
}
return nil
}
func (f *Filestore) Get(c *cid.Cid) (blocks.Block, error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment