-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: add wasi-0.3.0
draft
#164
Conversation
Followed the example of `wasi-http` and `wasi-clocks` duplicating the package in a subdirectory - Remove `would-block` error code - Replace `wasi:io/error.error` usage by `error-context` - Replace `wasi:io/streams.input-stream` return values by `stream<u8>` in return position - Replace `wasi:io/streams.output-stream` return values by `stream<u8>` in parameter position - Guests should be able to rely on `stream.new` to construct streams - Merge `read{,via-stream}` into a singular `read`. Both functions take an offset as a parameter and since they now return `stream<u8>`, callers can limit the amount of bytes read by using the `stream<u8>` directly, therefore functionality of both is identical - Merge `write{,via-stream}` into a singular `write`. Both functions take an offset and `stream<u8>` as a parameter. It is assumed that `error-context` returned by writes to the stream and reads from the stream are sufficient for error handling. Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Same as in WebAssembly/wasi-sockets#111 (comment), removed the |
This seems to be better aligned with latest specification on error context https://github.com/WebAssembly/component-model/blob/cbdd15d9033446558571824af52a78022aaa3f58/design/mvp/Explainer.md#error-context-type > A consequence of this, however, is that components *must not* depend on the > contents of `error-context` values for behavioral correctness. In particular, > case analysis of the contents of an `error-context` should not determine > *error recovery*; explicit `result` or `variant` types must be used in the > function return type instead (e.g., > `(func (result (tuple (stream u8) (future $my-error)))`). Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
f1cc147
to
a7b76d0
Compare
WebAssembly/wasi-filesystem#164 (comment) Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
WebAssembly#164 (comment) Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
e60c2bf
to
0a23094
Compare
WebAssembly#164 (comment) Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
0a23094
to
81bd8bb
Compare
WebAssembly/wasi-filesystem#164 (comment) Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Thanks for putting this together! Overall this looks good. One additional thing we should look into is translating Similar to this discussion in wasi-sockets, what would you think about renaming
Could we simplify this interface by eliminating the outer |
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
07e2d44
to
eed891a
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
eed891a
to
70fa400
Compare
This ensures that e.g.: ``` wit-bindgen markdown wit-0.3.0-draft -w imports --html-in-md ``` works with wit-bindgen 0.37 refs: WebAssembly/wasi-sockets@3abda6e refs: WebAssembly/wasi-sockets#111 (comment) Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@sunfishcode could you please take another look at this PR? |
This looks good. There may be some more details to figure out, but we can iterate from here. |
Refs https://github.com/orgs/bytecodealliance/projects/16/views/1?pane=issue&itemId=88153596
Refs WebAssembly/wasi-sockets#111
Refs #156 (change sets seem to be complimentary)
Followed the example of
wasi-http
andwasi-clocks
duplicating the package in a subdirectoryThis vendors
wasi-clocks
from WebAssembly/wasi-clocks#77would-block
error codewasi:io/error.error
usage byerror-context
wasi:io/streams.input-stream
return values bystream<u8>
in return positionwasi:io/streams.output-stream
return values bystream<u8>
in parameter position - Guests should be able to rely onstream.new
to construct streamsread{,via-stream}
into a singularread
. Both functions take an offset as a parameter and since they now returnstream<u8>
, callers can limit the amount of bytes read by using thestream<u8>
directly, therefore functionality of both is identicalwrite{,via-stream}
into a singularwrite
. Both functions take an offset andstream<u8>
as a parameter.It is assumed that
error-context
returned by writes to the stream and reads from the stream are sufficient for error handling.See also