-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: add blob handler #100
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, although I do wonder if we should instead overload raw block read interface instead of adding another dependency on carpark
export function withBlobHandler (handler) { | ||
return async (request, env, ctx) => { | ||
const url = new URL(request.url) | ||
if (!url.pathname.startsWith('/blob/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need the /blob/
interface as in is there reason why we would not use RAW cid handler instead ? If we did query content claims for raw blocks we would effectively get pointer to the file covering it's full content would not we ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, lets move this into the raw handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I also agree, and think actually having /blob
will just make everything more complicated on the reads side
This PR adds a `streamBlock(cid, [options])` method to Dagula that returns a `ReadableStream` of block bytes. You can optionally pass a byte range to extract a subset of bytes. Also `statBlock(cid, [options])` that retrieves block info i.e. total size in bytes. The idea is to allow dagula to serve byte ranges from big blocks without having to load the whole thing into memory. BREAKING CHANGE: The `Blockstore` interface now includes a `stream` method that returns a `ReadableStream` and a `stat` method that returns info (byte size). The format for the `entityBytes` option of `getPath` has changed. It is now an array of 1 or 2 numbers. See `Range` type for more details. refs storacha/freeway#100 (comment)
Supports byte ranges for raw block requests - including multipart. depends on storacha/dagula#44 refs storacha/freeway#100 (comment) BREAKING CHANGE: dependencies for handlers have changed, splitting out block, DAG and unixfs services. These are all satisfied by the `Dagula` class for the time being.
Pulls in latest gateway-lib and dagula to allow byte range requests to raw blocks (`?format=raw`). supersedes #100
Adds
GET/blob/:multihash
refs storacha/w3infra#363