-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refine GET /multihash/<multihash>
response for ndjson
#8
Labels
Comments
masih
added a commit
that referenced
this issue
Jan 30, 2023
The majority of IPNI clients use the single lookup APIs, either `/cid/<cid>` or `/multihash/<multihash>`, instead of the batch-find API. All three of the APIs use a uniform response schema, which includes the queried multihash directly in it. In a case where the request accepts streaming response, using the existing uniform response model becomes inefficient: a response may be flushed multiple times and as is each response would have to include the original multihash. The changes here propose a new trimmed-down response type when the request accepts `application/x-ndjson`, made-up of the inner provider record object only for the single multihash lookup APIs. This avoids the need for including the original multihash in every streamed response. Additionally, document the OpenAPI specification for the IPNI HTTP APIs for better human readability. Fixes #8
masih
added a commit
that referenced
this issue
Jan 30, 2023
The majority of IPNI clients use the single lookup APIs, either `/cid/<cid>` or `/multihash/<multihash>`, instead of the batch-find API. All three of the APIs use a uniform response schema, which includes the queried multihash directly in it. In a case where the request accepts streaming response, using the existing uniform response model becomes inefficient: a response may be flushed multiple times and as is each response would have to include the original multihash. The changes here propose a new trimmed-down response type when the request accepts `application/x-ndjson`, made-up of the inner provider record object only for the single multihash lookup APIs. This avoids the need for including the original multihash in every streamed response. Additionally, document the OpenAPI specification for the IPNI HTTP APIs for better human readability. Fixes #8
masih
added a commit
that referenced
this issue
Jan 30, 2023
The majority of IPNI clients use the single lookup APIs, either `/cid/<cid>` or `/multihash/<multihash>`, instead of the batch-find API. All three of the APIs use a uniform response schema, which includes the queried multihash directly in it. In a case where the request accepts streaming response, using the existing uniform response model becomes inefficient: a response may be flushed multiple times and as is each response would have to include the original multihash. The changes here propose a new trimmed-down response type when the request accepts `application/x-ndjson`, made-up of the inner provider record object only for the single multihash lookup APIs. This avoids the need for including the original multihash in every streamed response. Additionally, document the OpenAPI specification for the IPNI HTTP APIs for better human readability. Fixes #8
masih
added a commit
that referenced
this issue
Jan 30, 2023
The majority of IPNI clients use the single lookup APIs, either `/cid/<cid>` or `/multihash/<multihash>`, instead of the batch-find API. All three of the APIs use a uniform response schema, which includes the queried multihash directly in it. In a case where the request accepts streaming response, using the existing uniform response model becomes inefficient: a response may be flushed multiple times and as is each response would have to include the original multihash. The changes here propose a new trimmed-down response type when the request accepts `application/x-ndjson`, made-up of the inner provider record object only for the single multihash lookup APIs. This avoids the need for including the original multihash in every streamed response. Additionally, document the OpenAPI specification for the IPNI HTTP APIs for better human readability. Fixes #8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
GET
request is not repeated in the response or optionally included.Accept
request header permits it.The text was updated successfully, but these errors were encountered: