Skip to content

Commit 005c425

Browse files
authored
chore: update to WASI 0.2.1 (#25)
* chore: update to WASI 0.2.1 Signed-off-by: Roman Volosatovs <[email protected]> * ci: update wit-bindgen Signed-off-by: Roman Volosatovs <[email protected]> --------- Signed-off-by: Roman Volosatovs <[email protected]>
1 parent d9f62e6 commit 005c425

File tree

11 files changed

+289
-251
lines changed

11 files changed

+289
-251
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: WebAssembly/wit-abi-up-to-date@v17
14+
- uses: WebAssembly/wit-abi-up-to-date@v22
1515
with:
16-
wit-bindgen: '0.18.0'
16+
wit-bindgen: '0.32.0'

imports.md

+228-224
Large diffs are not rendered by default.

wit/container.wit

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// a Container is a collection of objects
22
interface container {
3-
use wasi:io/streams@0.2.0.{
3+
use wasi:io/streams@0.2.1.{
44
input-stream,
55
output-stream,
66
};
@@ -63,4 +63,4 @@ interface container {
6363
// This function returns the number of objects skipped, and a boolean indicating if the end of the stream was reached.
6464
skip-stream-object-names: func(num: u64) -> result<tuple<u64, bool>, error>;
6565
}
66-
}
66+
}

wit/deps.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[io]
2-
url = "https://github.com/WebAssembly/wasi-io/archive/v0.2.0.tar.gz"
3-
sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
4-
sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"
2+
url = "https://github.com/WebAssembly/wasi-io/archive/v0.2.1.tar.gz"
3+
sha256 = "2a74bd811adc46b5a0f19827ddbde89870e52b17615f4d0873f06fd977250caf"
4+
sha512 = "94624f00c66e66203592cee820f80b1ba91ecdb71f682c154f25eaf71f8d8954197dcb64503bc21e72ed5e812af7eae876df47b7eb727b02db3a74a7ce0aefca"

wit/deps.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
io = "https://github.com/WebAssembly/wasi-io/archive/v0.2.0.tar.gz"
1+
io = "https://github.com/WebAssembly/wasi-io/archive/v0.2.1.tar.gz"

wit/deps/io/error.wit

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package wasi:io@0.2.0;
2-
1+
package wasi:io@0.2.1;
32

3+
@since(version = 0.2.0)
44
interface error {
55
/// A resource which represents some error information.
66
///
@@ -11,16 +11,15 @@ interface error {
1111
/// `wasi:io/streams/stream-error` type.
1212
///
1313
/// To provide more specific error information, other interfaces may
14-
/// provide functions to further "downcast" this error into more specific
15-
/// error information. For example, `error`s returned in streams derived
16-
/// from filesystem types to be described using the filesystem's own
17-
/// error-code type, using the function
18-
/// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
19-
/// `borrow<error>` and returns
20-
/// `option<wasi:filesystem/types/error-code>`.
14+
/// offer functions to "downcast" this error into more specific types. For example,
15+
/// errors returned from streams derived from filesystem types can be described using
16+
/// the filesystem's own error-code type. This is done using the function
17+
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
18+
/// parameter and returns an `option<wasi:filesystem/types/error-code>`.
2119
///
2220
/// The set of functions which can "downcast" an `error` into a more
2321
/// concrete type is open.
22+
@since(version = 0.2.0)
2423
resource error {
2524
/// Returns a string that is suitable to assist humans in debugging
2625
/// this error.
@@ -29,6 +28,7 @@ interface error {
2928
/// It may change across platforms, hosts, or other implementation
3029
/// details. Parsing this string is a major platform-compatibility
3130
/// hazard.
31+
@since(version = 0.2.0)
3232
to-debug-string: func() -> string;
3333
}
3434
}

wit/deps/io/poll.wit

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.1;
22

33
/// A poll API intended to let users wait for I/O events on multiple handles
44
/// at once.
5+
@since(version = 0.2.0)
56
interface poll {
67
/// `pollable` represents a single I/O event which may be ready, or not.
8+
@since(version = 0.2.0)
79
resource pollable {
810

911
/// Return the readiness of a pollable. This function never blocks.
1012
///
1113
/// Returns `true` when the pollable is ready, and `false` otherwise.
14+
@since(version = 0.2.0)
1215
ready: func() -> bool;
1316

1417
/// `block` returns immediately if the pollable is ready, and otherwise
1518
/// blocks until ready.
1619
///
1720
/// This function is equivalent to calling `poll.poll` on a list
1821
/// containing only this pollable.
22+
@since(version = 0.2.0)
1923
block: func();
2024
}
2125

@@ -27,15 +31,17 @@ interface poll {
2731
/// The result `list<u32>` contains one or more indices of handles in the
2832
/// argument list that is ready for I/O.
2933
///
30-
/// If the list contains more elements than can be indexed with a `u32`
31-
/// value, this function traps.
34+
/// This function traps if either:
35+
/// - the list is empty, or:
36+
/// - the list contains more elements than can be indexed with a `u32` value.
3237
///
3338
/// A timeout can be implemented by adding a pollable from the
3439
/// wasi-clocks API to the list.
3540
///
3641
/// This function does not return a `result`; polling in itself does not
3742
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
3843
/// the pollables has an error, it is indicated by marking the source as
39-
/// being reaedy for I/O.
44+
/// being ready for I/O.
45+
@since(version = 0.2.0)
4046
poll: func(in: list<borrow<pollable>>) -> list<u32>;
4147
}

wit/deps/io/streams.wit

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.1;
22

33
/// WASI I/O is an I/O abstraction API which is currently focused on providing
44
/// stream types.
55
///
66
/// In the future, the component model is expected to add built-in stream types;
77
/// when it does, they are expected to subsume this API.
8+
@since(version = 0.2.0)
89
interface streams {
10+
@since(version = 0.2.0)
911
use error.{error};
12+
@since(version = 0.2.0)
1013
use poll.{pollable};
1114

1215
/// An error for input-stream and output-stream operations.
16+
@since(version = 0.2.0)
1317
variant stream-error {
1418
/// The last operation (a write or flush) failed before completion.
1519
///
@@ -29,6 +33,7 @@ interface streams {
2933
/// available, which could even be zero. To wait for data to be available,
3034
/// use the `subscribe` function to obtain a `pollable` which can be polled
3135
/// for using `wasi:io/poll`.
36+
@since(version = 0.2.0)
3237
resource input-stream {
3338
/// Perform a non-blocking read from the stream.
3439
///
@@ -56,13 +61,15 @@ interface streams {
5661
/// is not possible to allocate in wasm32, or not desirable to allocate as
5762
/// as a return value by the callee. The callee may return a list of bytes
5863
/// less than `len` in size while more bytes are available for reading.
64+
@since(version = 0.2.0)
5965
read: func(
6066
/// The maximum number of bytes to read
6167
len: u64
6268
) -> result<list<u8>, stream-error>;
6369

6470
/// Read bytes from a stream, after blocking until at least one byte can
6571
/// be read. Except for blocking, behavior is identical to `read`.
72+
@since(version = 0.2.0)
6673
blocking-read: func(
6774
/// The maximum number of bytes to read
6875
len: u64
@@ -72,13 +79,15 @@ interface streams {
7279
///
7380
/// Behaves identical to `read`, except instead of returning a list
7481
/// of bytes, returns the number of bytes consumed from the stream.
82+
@since(version = 0.2.0)
7583
skip: func(
7684
/// The maximum number of bytes to skip.
7785
len: u64,
7886
) -> result<u64, stream-error>;
7987

8088
/// Skip bytes from a stream, after blocking until at least one byte
8189
/// can be skipped. Except for blocking behavior, identical to `skip`.
90+
@since(version = 0.2.0)
8291
blocking-skip: func(
8392
/// The maximum number of bytes to skip.
8493
len: u64,
@@ -90,6 +99,7 @@ interface streams {
9099
/// The created `pollable` is a child resource of the `input-stream`.
91100
/// Implementations may trap if the `input-stream` is dropped before
92101
/// all derived `pollable`s created with this function are dropped.
102+
@since(version = 0.2.0)
93103
subscribe: func() -> pollable;
94104
}
95105

@@ -102,6 +112,11 @@ interface streams {
102112
/// promptly, which could even be zero. To wait for the stream to be ready to
103113
/// accept data, the `subscribe` function to obtain a `pollable` which can be
104114
/// polled for using `wasi:io/poll`.
115+
///
116+
/// Dropping an `output-stream` while there's still an active write in
117+
/// progress may result in the data being lost. Before dropping the stream,
118+
/// be sure to fully flush your writes.
119+
@since(version = 0.2.0)
105120
resource output-stream {
106121
/// Check readiness for writing. This function never blocks.
107122
///
@@ -112,6 +127,7 @@ interface streams {
112127
/// When this function returns 0 bytes, the `subscribe` pollable will
113128
/// become ready when this function will report at least 1 byte, or an
114129
/// error.
130+
@since(version = 0.2.0)
115131
check-write: func() -> result<u64, stream-error>;
116132

117133
/// Perform a write. This function never blocks.
@@ -127,6 +143,7 @@ interface streams {
127143
///
128144
/// returns Err(closed) without writing if the stream has closed since
129145
/// the last call to check-write provided a permit.
146+
@since(version = 0.2.0)
130147
write: func(
131148
contents: list<u8>
132149
) -> result<_, stream-error>;
@@ -155,6 +172,7 @@ interface streams {
155172
/// // Check for any errors that arose during `flush`
156173
/// let _ = this.check-write(); // eliding error handling
157174
/// ```
175+
@since(version = 0.2.0)
158176
blocking-write-and-flush: func(
159177
contents: list<u8>
160178
) -> result<_, stream-error>;
@@ -169,14 +187,16 @@ interface streams {
169187
/// writes (`check-write` will return `ok(0)`) until the flush has
170188
/// completed. The `subscribe` pollable will become ready when the
171189
/// flush has completed and the stream can accept more writes.
190+
@since(version = 0.2.0)
172191
flush: func() -> result<_, stream-error>;
173192

174193
/// Request to flush buffered output, and block until flush completes
175194
/// and stream is ready for writing again.
195+
@since(version = 0.2.0)
176196
blocking-flush: func() -> result<_, stream-error>;
177197

178198
/// Create a `pollable` which will resolve once the output-stream
179-
/// is ready for more writing, or an error has occured. When this
199+
/// is ready for more writing, or an error has occurred. When this
180200
/// pollable is ready, `check-write` will return `ok(n)` with n>0, or an
181201
/// error.
182202
///
@@ -193,6 +213,7 @@ interface streams {
193213
/// preconditions (must use check-write first), but instead of
194214
/// passing a list of bytes, you simply pass the number of zero-bytes
195215
/// that should be written.
216+
@since(version = 0.2.0)
196217
write-zeroes: func(
197218
/// The number of zero-bytes to write
198219
len: u64
@@ -222,14 +243,15 @@ interface streams {
222243
/// // Check for any errors that arose during `flush`
223244
/// let _ = this.check-write(); // eliding error handling
224245
/// ```
246+
@since(version = 0.2.0)
225247
blocking-write-zeroes-and-flush: func(
226248
/// The number of zero-bytes to write
227249
len: u64
228250
) -> result<_, stream-error>;
229251

230252
/// Read from one stream and write to another.
231253
///
232-
/// The behavior of splice is equivelant to:
254+
/// The behavior of splice is equivalent to:
233255
/// 1. calling `check-write` on the `output-stream`
234256
/// 2. calling `read` on the `input-stream` with the smaller of the
235257
/// `check-write` permitted length and the `len` provided to `splice`
@@ -240,6 +262,7 @@ interface streams {
240262
///
241263
/// This function returns the number of bytes transferred; it may be less
242264
/// than `len`.
265+
@since(version = 0.2.0)
243266
splice: func(
244267
/// The stream to read from
245268
src: borrow<input-stream>,
@@ -252,6 +275,7 @@ interface streams {
252275
/// This is similar to `splice`, except that it blocks until the
253276
/// `output-stream` is ready for writing, and the `input-stream`
254277
/// is ready for reading, before performing the `splice`.
278+
@since(version = 0.2.0)
255279
blocking-splice: func(
256280
/// The stream to read from
257281
src: borrow<input-stream>,

wit/deps/io/world.wit

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
package wasi:io@0.2.0;
1+
package wasi:io@0.2.1;
22

3+
@since(version = 0.2.0)
34
world imports {
5+
@since(version = 0.2.0)
46
import streams;
7+
8+
@since(version = 0.2.0)
59
import poll;
610
}

wit/types.wit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Types used by blobstore
22
interface types {
3-
use wasi:io/streams@0.2.0.{input-stream, output-stream};
3+
use wasi:io/streams@0.2.1.{input-stream, output-stream};
44

55
// name of a container, a collection of objects.
66
// The container name may be any valid UTF-8 string.

wit/world.wit

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package wasi:[email protected];
22

33
world imports {
44
import blobstore;
5-
}
5+
}

0 commit comments

Comments
 (0)