-
Notifications
You must be signed in to change notification settings - Fork 38
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 CollectingBody for cache use cases #452
base: main
Are you sure you want to change the base?
Conversation
`CollectingBody` reads from a `Body` and: - Stores the data and trailers written, for future delivery in cache lookups - Offers a `read() -> Body` endpoint. The read can proceed concurrently with writes, or after the write has completed.
67d06cd
to
7f2e452
Compare
lib/src/collecting_body.rs
Outdated
return; | ||
} | ||
|
||
// OK, we have some data. Forward it. In order, |
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.
The state pattern described above also means these comments become a match
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.
Kinda?
We can't hold the Ref<CollectingBodyInner>
across an .await
point (i.e. a send), so we have to match on the inside then do the work. (We don't want to block the send on a receive happening - one way to deadlock.) So it's still a matter of copying out the work and then matching on the length/Someness.
Missed the "skip already read chunks" step.
CollectingBody
reads from aBody
and:lookups
read() -> Body
endpoint. The read can proceed concurrentlywith writes, or after the write has completed.