ipni / specs

:book: Technical Specification of IPNI Protocols
12 stars 2 forks source link

Refine `GET /multihash/<multihash>` response for `ndjson` #8

Closed masih closed 1 year ago

masih commented 1 year ago

The response structure used by IPNI for GET /multihash/<multihash> is optimised for batch find: it includes the multihash that is being looked up as base64 encoded string, along with a nested array of results.

I believe the rationale has been to use the same response model for both batch find, and single find request. For non-streaming responses this is fine; however, for responses streamted using new-line delimited json (i.e. ndjson) it becomes suboptimal:

This is less than optimum considering the vast majority of traffic received by cid.contact is for explicit multihash lookups.

Consider spec changes for a more optimal response structure for single multihash lookup, such that: