Skip to content

feat(p3): only allow body.stream calls once #156

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

Closed

Conversation

rvolosatovs
Copy link
Contributor

@rvolosatovs rvolosatovs commented Mar 11, 2025

Only allow body.stream to be called once.

This simplifies the host implementation and the amount of bookkeeping that would need to be performed by the runtime. I cannot really come up with a use case that would be impossible for guests to implement using the "at-most-once" call semantics.

We can always relax this requirement at a later point of time if it becomes an issue, but we can't quite go the other way round

This is aligned with e.g.:

@lukewagner
Copy link
Member

Ah, the intended design (which could perhaps be documented more clearly) was that if you call %stream, then close it, then call %stream again, you'll resume where you left off (not get a copy of the contents since the beginning), up until you call finish. The idea was that this could be useful in chaining scenarios where component A consumes the first part (of a multi-part) request and then passes the request on to component B. But if it's a significant impl obstacle, happy to discuss here.

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