Skip to content
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

Add support for a new StreamingBody extractor #617

Merged

Conversation

sunshowers
Copy link
Contributor

@sunshowers sunshowers commented Mar 21, 2023

Per RFD 353, add support for a new extractor that can provide data as a
stream of Bytes chunks. This means that large request payloads won't
have to buffer everything into a single, contiguous chunk of memory.

Also add some examples showing how to use the extractor to operate on
chunks in a streaming fashion. (There are also other potential examples
we can add here, such as compressing and/or decompressing data on the
fly). I haven't implemented those here.

Finally, switch over the other extractors to be implemented on top of
StreamingBody. In effect, the other extractors just provide a
differently-shaped API on top of StreamingBody.

This PR doesn't implement support for the other determination in RFD
353, which is to allow some endpoints' max payload sizes to be set to a
higher limit. That's in #618.

Created using spr 1.3.4
Created using spr 1.3.4
Copy link
Collaborator

@davepacheco davepacheco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

dropshot/tests/test_demo.rs Outdated Show resolved Hide resolved
dropshot/src/extractor/body.rs Outdated Show resolved Hide resolved
dropshot/src/extractor/body.rs Outdated Show resolved Hide resolved
Created using spr 1.3.4
Created using spr 1.3.4
@sunshowers sunshowers merged commit ccce224 into main Mar 24, 2023
@sunshowers sunshowers deleted the sunshowers/spr/add-support-for-a-new-streamingbody-extractor branch March 24, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants