Go-ipfs: `ipfs block rm`

Created on 28 Jun 2016  路  14Comments  路  Source: ipfs/go-ipfs

Currently, the only way of deleting blocks in go-ipfs is through repo gc. In js-ipfs land, since the Block Service exposes an interface to delete, we also have exposed that on the block API. It is very convenient for testing and a quick way to delete a specific block.

Can we expose this feature in go-ipfs too?

dihard kinenhancement topiblockstore

Most helpful comment

I know the issues involved so I take responsibility for this one.

All 14 comments

Is should be really easy as we also have Delete call in blockstore. Problem with deleting block is that it might be component of different file or directory and as user would probably expect the removal of all blocks connected to file or directory it is even bigger issues.

@Kubuxu that would be something for the files api. The block API is really well scoped as the put and get only also return or add a single block

Ahh, right. So yeah, ipfs block rm should be possible and quite easy to do.

How should removing pinned blocks be handled? Disallow? Allow and ignore pin? (This could then cause many problems with ipfs commands, for example the garbage collector will abort) Allow and attempt to do something about the pin? (Not so easy unless the pin a a direct pin.)

Yeah, we need to make sure we don't remove blocks that are pinned.

Good point. If a block is pinned, it should error saying that it is pinned

I agree at least by default. However, for performance reasons, we might want to add an option to disable this detection if the user knows what they are doing.

I am not 100% sure I understand the pining code but it seams that to detect indirect pins all recursive pins need to be walked, thus making pin detection expensive. It looks like there might be some caching going on in the datastore under the prefix 'local/pins/indirect/keys/' but it doesn't seam like this is used by pin.IsPinnedWithType().

Yeah, pin detection is expensive. We can optimize with various caching structures though in the future.

I know the issues involved so I take responsibility for this one.

Participating.

Any update on this one? :)

@diasdavid please see #2962

we have this now :)

woot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whyrusleeping picture whyrusleeping  路  4Comments

slrslr picture slrslr  路  3Comments

magik6k picture magik6k  路  3Comments

Jorropo picture Jorropo  路  3Comments

zignig picture zignig  路  3Comments