-
Notifications
You must be signed in to change notification settings - Fork 76
Description
The goal of this is to clarify and create consistency with the initial endpoints supported for booster-http now that we've done a couple iterations of functionality. This is a followup of #946 and #888.
Endpoint Overview
A user has a GIF stored on IPFS, it’s 1.9MB and totals 9 blocks. Their GIF has been aggregated with other content in a car file via an Aggregator and stored on Filecoin.
$ ipfs dag stat {cid}
Size: 1907628, NumBlocks: 9The user, and relevant stakeholders (SP’s) may retrieve the data via the following methods:
Method 1. The user wants to get their gif back via the gateway as is, they can curl the CID without headers. This is a trusted return as you cannot verify the data until you have all of it. This is also subject to IPLD codec deserialization and could fail if the codec is unknown. In which case, the user may wish to get the CAR.
$ curl http://{booster-http.url}/ipfs/{cid} --output cool.gifMethod 2. If the user wants their data back in a CAR and handle IPLD deserialization themselves, they can add the car format in the header. This is particularly useful if Boost doesn't know the IPLD codec of the data:
$ curl -H "Accept:application/vnd.ipld.car;" http://{booster-http.url}/ipfs/{cid} --output cool.gif.carMethod 3. If the user wants their data back block by block, they can retrieve and parse the first block of the GIF with the raw ipld format. This would be useful if the user wants to iterate over the blocks, but is likely a low priority use case for Filecoin. It could be supported to match the IPFS Trustless gateway spec though.
$ curl -H "Accept:application/vnd.ipld.raw;" http://{booster-http.url}/ipfs/{cid} --output {cid}.blockMethod 4. In Filecoin we also have Pieces, which is a padded car file of the original deal. Users may wish to retrieve the whole piece byte stream to reduce risk of incompatible commp, such as when replicating deals.
$ curl http://{booster-http.url}/piece/{cid} --output {cid}.pieceIf the user doesn’t want the piece, and just wants their unpadded car file, they can access it via the /ipfs endpoint mentioned in method 2 above.
Quick Summary
This would leave us with 2 endpoints, /ipfs and /piece.
/ipfs/{cid}⇒ Results in the deserliazed ipld dag, ie your GIF./ipfs/{cid}?format=car⇒ A car stream of the serialized ipld structure. Can also be used to get the Deal Root Payload/ipfs/{cid}?format=raw⇒ Results in the raw block of the cid requested and ONLY that block./piece/{cid}?format=piece⇒ The full, padded Piece. (cid.piece) Format is alwayspieceand does not need to be specified.
Note: As shown in the above, abbreviated urls, the query param format can be used instead of the content type headers. This matches behavior of the IPFS gateway spec.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status