-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: update DAG API to match [email protected] changes #3917
Conversation
f95fbfc
to
0a4622b
Compare
One of the failing examples is js-ipfs-custom-ipld-formats, but there's a problem, which I outline @ ipfs-examples/js-ipfs-custom-ipld-formats#1 |
@rvagg is the TODO list here still up to date? |
fe5bb34
to
71d4718
Compare
6af1270
to
2ac3968
Compare
@lidel I've updated OP with the current status. I reckon this is good to merge as it is but there's some outstanding items to do and discuss that I've documented there. |
2ac3968
to
4fe2e9f
Compare
I don't understand the lint error on CI, I can't repro locally |
any updates on this? It's blocking us at the moment. |
I think CI is broken because @hugomrdias does the above make sense? Is this something we need to fix on aegir side? ps. I wanted to confirm this breakage is caused by external dependency change and re-run CI on PR that was green, and it failed for a different reason. 💀 💀 |
Any update on this? It's a blocker for us as well. |
@rvagg : are you able to get the build to pass? @achingbrain will take on the code review afterwards. |
Fixes: #3914 Ref: https://github.com/ipfs/go-ipfs/blob/master/CHANGELOG.md#v0100-2021-09-30 --format and --input-enc have been replaced with --input-codec and --store-codec and mean something a little different. You now supply raw input and instruct the server which --input-codec that data is in which it will decode, then re-encode with --store-codec before storing it and providing you with the CID. We accept plain JavaScript objects to encode with --store-codec via the API here, defaulting to dag-cbor, and send that to the server as encoded bytes using that codec, to be stored using that codec. If you supply an --input-codec then we assume you're supplying raw, encoded bytes using that codec and we pass that directly on to the server to handle.
4fe2e9f
to
6720722
Compare
Co-authored-by: Marcin Rataj <[email protected]> Co-authored-by: achingbrain <[email protected]> BREAKING CHANGE: `ipfs.dag.put` no longer accepts a `format` arg, it is now `storeCodec` and `inputCodec`. `'json'` has become `'dag-json'`, `'cbor'` has become `'dag-cbor'` and so on
Current status:
dag.put
since that's where the bulk of the changes are--output-codec
fordag get
which matches go-ipfs, roughly:--data-enc
will still work, but otherwise that argument isn't used like it was before (and I'm pretty sure it's js-ipfs specific)Outstanding:
This is a Draft PR because there's more to do. The initial, most important thing is solving #3914 so the DAG PUT API works against 0.10, which this does. I think it'll end up being a non-breaking change for users unless they're using
format
option or expecting to get a v0 CID from a dag-pb (which go-ipfs doesn't do anymore).As a fun side effect, this introduces a possible optimisation for users in some situations - if they have the already-encoded bytes of a block then they can use DAG PUT to send that in and bypass the encode/decode cycles on the client side and the server will store it as is if they provide
inputCodec
. Although the BLOCK API is probably more appropriate for that use-case.To do:
feat!: match [email protected] dag put options and semantics
Fixes: #3914
Ref: https://github.com/ipfs/go-ipfs/blob/master/CHANGELOG.md#v0100-2021-09-30
--format and --input-enc have been replaced with --input-codec and
--store-codec and mean something a little different. You now supply
raw input and instruct the server which --input-codec that data is
in which it will decode, then re-encode with --store-codec before
storing it and providing you with the CID.
We accept plain JavaScript objects to encode with --store-codec via
the API here, defaulting to dag-cbor, and send that to the server as
encoded bytes using that codec, to be stored using that codec.
If you supply an --input-codec then we assume you're supplying raw,
encoded bytes using that codec and we pass that directly on to the
server to handle.