-
Notifications
You must be signed in to change notification settings - Fork 24
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
WASI-http needs a sequence diagram #24
Comments
Yeah, we've got a long way to go to properly document this interface and sequence diagrams are a good idea. Coincidentally, the thing I'm putting finishing touches on now (in the So given the two currently-proposed handle types ( To avoid both of these problems, I think we instead want the incoming-request-consume: func(self: borrow<incoming-request>) -> result<child-own<incoming-stream, self>> (exact Wit syntax TBD) which says that the returned In the interim, I'd suggest having the host implementation of WDYT? |
I'm not sure what the value of |
For requests/responses, there's at most 1 stream and so it's less clear. In general, it's useful for all the different uses of streams in WASI to be symmetric with how they use streams so that the bindings for wasi-io (and later Preview 3 native streams) can be shared. But also, in the future, it might be useful to relax the rules to allow To avoid burdening the programmer, the guest bindings can maintain a list of child resources and automatically close them when the parent handle is destroyed or transferred. This is what I was assuming would happen for scripting language bindings (where each handle is given an object wrapper that switches to a throw-on-access state when the underlying handle goes away). Having the guest maintain this bookkeeping instead of the host makes sense b/c often, in addition to dropping the child handles, there is some amount of guest state that needs to be updated. |
I'm good with the "closing the parent, closes the children" behavior with "closing the child" being an optional optimization that allows the client to release resources. I will send a PR to update the docs to add clarity. |
There's a number of functions that allocate/return values (e.g. get a stream for a response body) and methods which dispose of those values (e.g. drop_output_stream).
It's not very clear from the documentation or from the method signatures what is legal and what is a a problem.
e.g. if I call:
Note I dropped the response before I dropped the stream from the response, is that legal? Who owns the stream? Is it the caller or is it the response object?
Similarly, given the code:
Note that I dropped the output stream before I sent the request, so that seems to imply that the request object owns the output stream.
Given the complexity of the various methods to acquire things like streams and responses and requests and all of the methods to drop them, it is very difficult to know the correct way to either call the code or implement the WIT interface. This means that clients will be confused, and different implementations will behave differently.
We need to either publish a set of acceptance tests that all implementations must be able to run successfully, and/or document the sequence of calls that are "expected" or "acceptable" so that we can have consistency.
The text was updated successfully, but these errors were encountered: