Skip to content
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

Add Ipfs-DagSize and/or Ipfs-DataSize to gateway responses #461

Open
lidel opened this issue May 26, 2022 · 0 comments
Open

Add Ipfs-DagSize and/or Ipfs-DataSize to gateway responses #461

lidel opened this issue May 26, 2022 · 0 comments

Comments

@lidel
Copy link
Member

lidel commented May 26, 2022

This is a placeholder issue for writing spec and tracking implementation.

The need is to expose equivalent of ipfs files stat's Size and CumulativeSize on HTTP gateway somehow, allowing light clients to understand how big is the DAG before fetching it as a CAR etc.

  • Ipfs-DagSize total size of the DAG (user data + DAG metadata, IPLD envelopes etc)
  • Ipfs-DataSize total size of the raw data (without DAG metadata, IPLD envelopes etc)

We don't want expensive equivalent of ipfs dag stat for Unixfs, we want to leverage hints from UnixFS. It could be limited to formats like UnixFS, or single-block dag-cbor etc, which include total sizes in the root blocks, removing the need for expensive ipfs dag stat of entire DAG.

Implementation options

  • 🟢 HTTP Headers
    • Ipfs-DagSize and Ipfs-DataSize headers with value in bytes
    • pro: simple and easy to implement, JS apps already use Content-Type for this (because without compression it matches payload size), we should not break them without giving a replacement header
    • 💡 caveat: unnecessary work on every request, unless we limit them to HEAD responses
  • ⛔ Custom content type that returns useful metadata
    • would be opt-in Accept HTTP header or format URL arg)
    • pro: could be leveraged for things other than size info
    • con: complexity, need to decide on JSON schema, harder for gateways and clients to adopt

cc @vasco-santos I know you needed something like this a while ago

@lidel lidel added the need/triage Needs initial labeling and prioritization label May 26, 2022
@lidel lidel self-assigned this May 26, 2022
@lidel lidel removed the need/triage Needs initial labeling and prioritization label Jun 6, 2022
@lidel lidel changed the title Add X-Ipfs-DagSize and X-Ipfs-DataSize to gateway responses Add Ipfs-DagSize and Ipfs-DataSize to gateway responses Feb 14, 2023
@lidel lidel transferred this issue from ipfs/in-web-browsers Jan 29, 2024
@lidel lidel removed their assignment Jan 29, 2024
@lidel lidel changed the title Add Ipfs-DagSize and Ipfs-DataSize to gateway responses Add Ipfs-DagSize and/or Ipfs-DataSize to gateway responses Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant