-
Notifications
You must be signed in to change notification settings - Fork 190
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
RFC: Callbacks for ByteStream
and SdkBody
#1307
Conversation
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
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.
Great start!
update: Arc callbacks instead of boxing them remove: most bounds from ByteStreamReadCallback trait add: PartialEq/Eq impl for Inner that disregards callback list
A new generated diff is ready to view.
|
A new doc preview is ready to view. |
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.
I think we'll need to do some refactoring to SdkBody/ByteStream. As it stands, on the request side, we quickly call into_inner
on the ByteStream prior to passing it into the Hyper—this means that the checksumming can't be solely inside of ByteStream
(or we need to have ByteStream
impl Body directly?
Perhaps we should just teach SdkBody
about the callbacks, albeit, through a private interface?
There's a lot of design options here, probably some prototyping is required.
update: RFC with checksum callback example
ByteStream
and SdkBody
ByteStream
and SdkBody
ByteStream
and SdkBody
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
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.
LGTM!
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
/// This callback is called once all chunks have been read. If the callback encountered 1 or more errors | ||
/// while running `update`s, this is how those errors are raised. Implementors may return a [`HeaderMap`][HeaderMap] | ||
/// that will be appended to the HTTP body as a trailer. This is only useful to do for streaming requests. | ||
fn trailers(&self) -> Result<Option<HeaderMap<HeaderValue>>, BoxError> { Ok(None) } |
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.
I think that for SdkBody
I can have it inspect itself and only append trailers if the inner variant is Inner::Streaming
but I'm not sure that covers every streaming request case.
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.
LGTM!
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
Motivation and Context
This RFC demonstrates how we could add callback that get triggered when reading chunks from a
ByteStream
orSdkBody
. The RFC also contains one example of how we could use these callbacks to implement a checksum validator for requests.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.