Conversation
Created using spr 1.3.4
|
I haven't yet looked at the code, but I had a couple of questions about (my understanding of) the approach: Do we need to expose a separate interface for large requests in addition to small ones? This seems like an additional burden to end-users we should be reluctant to impose. Would it be feasible to change |
We definitely don't need to — the
Again, that's definitely possible to do if we're willing to break API compatibility. We could have I mostly went for this approach for API compat reasons, but there's a lot of available design space here. |
|
First, I don't think we need to be beholden to API compatibility. Second, I think we could encapsulate an |
|
Hmm, doing that work would be an async function and as_bytes/as_str are synchronous currently. |
|
I'll put up an alternative version of this PR which breaks BC. |
|
Put up #542 -- converting this to a draft since I agree that that's definitely a better, more orthogonal API. |
|
Abandoned in favor of #556. |
The current
UntypedBodyextractor writes data into a singleVec<u8>.Consider what happens if the body is large (e.g. 100MB, which can happen
if uploading an artifact over HTTP). As each chunk (typically 10-100KB)
comes in, we'll have to both copy data from the incoming
Bytes, andreallocate the
Vecover and over.To avoid this issue, Eliza Weisman and I wrote buf-list, which
represents a list (really a queue) of chunks that can be operated on
using standard Tokio and other abstractions:
https://crates.io/crates/buf-list.
Add a
ChunkedBodyextractor that uses aBufListinside, avoidingthis issue. Also add
ChunkedBodyto usage suggestions.One other change I did is to remove the nonexistent type parameter
Jfrom
UntypedBody<J>suggestions -- that didn't look right.Questions
BufListneeds to be exposed as a public API. It's currently at 0.1 -- I could release a 1.0 if that would be helpful as far as exposing in the API goes. What do you think?