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 CollectingBody for cache use cases #452

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cceckman-at-fastly
Copy link
Contributor

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.

@cceckman-at-fastly cceckman-at-fastly requested review from a team, dcaba and aturon and removed request for a team March 6, 2025 15:31
`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.
@cceckman-at-fastly cceckman-at-fastly force-pushed the cceckman/collecting-body branch from 67d06cd to 7f2e452 Compare March 11, 2025 16:56
return;
}

// OK, we have some data. Forward it. In order,
Copy link

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

Copy link
Contributor Author

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.

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