Closed lidel closed 1 year ago
Eyeballed metrics on staging, unsurprisingly the file
scope is requested the most often:
We had another round of renames in https://github.com/ipfs/specs/pull/402#issuecomment-1544819745:
- name changes based on rough consensus. (Juan, Rod, and Adin all suggested removing ambiguity and name dependency on CAR and UnixFS formats, making things more future-proof):
car-scope=file
→dag-scope=entity
bytes
→entity-bytes
Repurposing this issue to align bifrost-gateway implementation with specs.
Problem
The
depth=0|1|all
parameter was provisionally introduced as part of Rhea project and we quickly realized we need to improve if we want to upstream it to https://specs.ipfs.tech/http-gateways/trustless-gateway/The name is unfortunate, because after all Graph API interations we've ended up with "
depth
" that lost original meaning ("how deep to fetch a DAG (or path)"), and ended up meaning "logical depth from the perspective of end user thinking in terms of a single block, a file or a directory enumeration".In that framing, the name makes very little sense:
depth=0
depth=1
depth=2
makes sense only for directories and DAGs built out of IPLD things like DAG-JSON/CBOR documents (but we don't use this for Rhea nor need for gateway atm).I agree, we ended up with three states:
0
- blocks for path + only the root block for terminal CIDIPFSBackend.GetBlock
and forIPFSBackend.ResolvePath
1
- blocks for path + all blocks for a file, or a minimal set of blocks to enumerate directory or HAMTIPFSBackend.Get
requests, as we don't want to over-fetch directories, and we don't know which path ends with a dirall
- blocks for path + all blocks for entire DAGIPFSBackend.GetAll
)and CAR (IPFSBackend.GetCAR
) responses, but this is also the implicit default for?format=car
, so we don't really need this.I think we both want to clean this up. and we agree "depth" is simply an invalid term here. I also agree with you, strings are more meaningful than numbers for this abstraction layer.
What we want
Solution
Based on my notes and discussion with Hannah, we agreed
car-scope=block|file|all
is a better framing:depth=0
→car-scope=block
depth=1
→car-scope=file
(non-files, like directories, and IPLD Maps only return blocks necessary for their enumeration)file
here to make more sense to non-PL user. "file" is a synonym for "the blocks needed to interact with the ADL in the transformed view", and the pathing on/ipfs/
defines the implicit ADLs to use.depth=all
→car-scope=all
(implicit default whencar-scope
is unset, send everything)This is way easier to reason about, no need to read docs, hard to make a mistake, and a better fit for a future IPIP that updates https://specs.ipfs.tech/http-gateways/trustless-gateway/ which we want to do this year.
Transition plan.
bifrost-gateway
starts sending requests with bothdepth
andcar-scope
car-scope
to lassie https://github.com/filecoin-saturn/L1-node/issues/323#issuecomment-1499478883car-scope
→ https://github.com/filecoin-saturn/L1-node/pull/324car-scope=block
→ https://github.com/filecoin-saturn/L1-node/pull/324/files#r1160386359biforst-gateway
stops sendingdepth
(https://github.com/ipfs/bifrost-gateway/pull/144)car-scope
→ https://github.com/ipfs/specs/pull/402#issuecomment-1544819745Updated plan
bifrost-gateway
starts sending requests withdepth
,car-scope
anddag-scope
AND bothbytes
andentity-bytes
as noted in IPIP-402 – https://github.com/ipfs/bifrost-gateway/pull/108