-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore records with IDENTITY
CID in IndexSorted
#218
Conversation
I'm not totally opposed to this as a defensive mechanism. in the past we've used the pattern of wrapping the blockstore in an idstore https://github.com/ipfs/go-ipfs-blockstore/blob/master/idstore.go when there is the potential for interaction with identity-hashed blocks. |
Yup that makes sense; will do 🍻 |
I'm a soft +1 on all our layers behaving like this, but it's a bit tricky since if we don't do it completely then we set up a false expectation for users that they don't need to wrap or be careful with the layers they're interacting with. I don't think there's harm in doing it here, it's quite nice, especially if you just want to use a CARv2 as a raw blockstore, but the user expectation problem will be the thing that gets us, if anything. |
Having implemented an explicit error when given This is because, in order to explicitly error out the blockstore needs to decode the CID hash, and right there we have all the information to do what
@willscott @rvagg @aarshkshah1992 What are your thoughts? |
I think my weakly held position on this is that CARv2 is somewhat likely to be used as a stand-alone blockstore, for IPLD applications that exist outside of IPFS and want a simple immutable block store, so if the information is at hand already (i.e. it's cheap), I think it should transparently handle identity CIDs. |
ac3b3fa
to
c09aef7
Compare
After much discussion, this PR now gracefully handles Thanks @willscott @rvagg |
2d07c6d
to
3dfd1c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this behavior be mentioned in the blockstore package godoc? It seems pretty relevant at a high level.
8b7eb8b
to
c9d8b61
Compare
Skip `IDENTITY` CIDs in `IndexSorted`, as required by CARv2 specification. Re-generate `sample-wrapped-v2.car` testdata, since its previous index contained CIDs with `IDENTITY` multihash. Gracefully handle CIDs with `IDENTITY` multihash code in the `blockstore` API. Since `Get`, `GetSize` and `Has` interfaces rely on the index, decode given keys directly to satisfy calls for such CIDs. See: - https://ipld.io/specs/transport/car/carv2/#index-format Fixes #215
c9d8b61
to
355d5e6
Compare
Skip
IDENTITY
CIDs inIndexSorted
, as required by CARv2specification.
Re-generate
sample-wrapped-v2.car
testdata, since its previous indexcontained CIDs with
IDENTITY
multihash.Gracefully handle CIDs with
IDENTITY
multihash code in theblockstore
API. SinceGet
,GetSize
andHas
interfaces rely onthe index, decode given keys directly to satisfy calls for such CIDs.
See:
Fixes #215