-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: allow independent retrieval of trailers #154
base: main
Are you sure you want to change the base?
feat: allow independent retrieval of trailers #154
Conversation
This commit changes wasi:http/types#body.finish to forward the optionally present trailers, rather than retrieve them with the possibility of generating an error along the way. With this change, callers of `body.finish` will have to retreive trailers on their own, which *may* produce an efficiency gain in the case where trailers are present but not needed, and avoiding work of checking for trailers in the first place. Signed-off-by: Victor Adossi <[email protected]>
272f039
to
beed353
Compare
@vados-cosmonic I'm wondering if we should stick with the Obviously, the asymmetry implies that the implementation will need to transpose a |
Not to complicate things further, but we could even make |
Hey @dicej waht do you think about actually changing the constructor for body to one without trailers and separating the ability to add/set trailers (either a different constructor or a setter are both fine).
So I found this difficult to do in the impl without creating another future during
This is certainly an interesting idea -- does this make it a little more difficult in that the write end has to remember to close the future? If this introduces the possibility of a hang due to incorrectly implemented writers it might increase the hurdle. This also kind of makes me want to separate the common case and the with-trailers case into different functions, what do you think? @pchickey if you want to chime in on the expanded interface changes (separating with trailers functions out), would appreciate it! |
Yeah, you'd need to create another future, although I think we can avoid that if
They will either need to remember to send |
BTW, I'm also fine with removing the trailers parameter from the constructor and e.g. adding a new |
I'm in favor of this!
A tiny nit, but I personally like just Will re-write the impl and make updates here with that in mind. |
Signed-off-by: Victor Adossi <[email protected]>
Co-authored-by: Joel Dice <[email protected]>
This commit changes wasi:http/types#body.finish to forward the optionally present trailers, rather than retrieve them with the possibility of generating an error along the way.
With this change, callers of
body.finish
will have to retreive trailers on their own, which may produce an efficiency gain in the case where trailers are present but not needed, and avoiding work of checking for trailers in the first place.👀 Implementation preview
As this is a WASI p3 feature (for which work is ongoing in the wasip3-prototyping repository), you can "preview" the effects of this change on the implementation in the PR there.