Skip to content

Commit 3b7e098

Browse files
authored
chore: update wasi:io (#29)
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent 20c2c61 commit 3b7e098

10 files changed

+204
-126
lines changed

keyvalue-handle-watch.md

+72-44
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<ul>
33
<li>Imports:
44
<ul>
5-
<li>interface <a href="#wasi:io_poll"><code>wasi:io/poll</code></a></li>
6-
<li>interface <a href="#wasi:io_streams"><code>wasi:io/streams</code></a></li>
5+
<li>interface <a href="#wasi:io_error_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
6+
<li>interface <a href="#wasi:io_poll_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
7+
<li>interface <a href="#wasi:io_streams_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
78
<li>interface <a href="#wasi:keyvalue_wasi_cloud_error"><code>wasi:keyvalue/wasi-cloud-error</code></a></li>
89
<li>interface <a href="#wasi:keyvalue_types"><code>wasi:keyvalue/types</code></a></li>
910
<li>interface <a href="#wasi:keyvalue_readwrite"><code>wasi:keyvalue/readwrite</code></a></li>
@@ -17,15 +18,70 @@
1718
</ul>
1819
</li>
1920
</ul>
20-
<h2><a name="wasi:io_poll">Import interface wasi:io/poll</a></h2>
21+
<h2><a name="wasi:io_error_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
22+
<hr />
23+
<h3>Types</h3>
24+
<h4><a name="error"><code>resource error</code></a></h4>
25+
<p>A resource which represents some error information.</p>
26+
<p>The only method provided by this resource is <code>to-debug-string</code>,
27+
which provides some human-readable information about the error.</p>
28+
<p>In the <code>wasi:io</code> package, this resource is returned through the
29+
<code>wasi:io/streams/stream-error</code> type.</p>
30+
<p>To provide more specific error information, other interfaces may
31+
provide functions to further &quot;downcast&quot; this error into more specific
32+
error information. For example, <a href="#error"><code>error</code></a>s returned in streams derived
33+
from filesystem types to be described using the filesystem's own
34+
error-code type, using the function
35+
<code>wasi:filesystem/types/filesystem-error-code</code>, which takes a parameter
36+
<code>borrow&lt;error&gt;</code> and returns
37+
<code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
38+
<h2>The set of functions which can &quot;downcast&quot; an <a href="#error"><code>error</code></a> into a more
39+
concrete type is open.</h2>
40+
<h3>Functions</h3>
41+
<h4><a name="method_error.to_debug_string"><code>[method]error.to-debug-string: func</code></a></h4>
42+
<p>Returns a string that is suitable to assist humans in debugging
43+
this error.</p>
44+
<p>WARNING: The returned string should not be consumed mechanically!
45+
It may change across platforms, hosts, or other implementation
46+
details. Parsing this string is a major platform-compatibility
47+
hazard.</p>
48+
<h5>Params</h5>
49+
<ul>
50+
<li><a name="method_error.to_debug_string.self"><code>self</code></a>: borrow&lt;<a href="#error"><a href="#error"><code>error</code></a></a>&gt;</li>
51+
</ul>
52+
<h5>Return values</h5>
53+
<ul>
54+
<li><a name="method_error.to_debug_string.0"></a> <code>string</code></li>
55+
</ul>
56+
<h2><a name="wasi:io_poll_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
2157
<p>A poll API intended to let users wait for I/O events on multiple handles
2258
at once.</p>
2359
<hr />
2460
<h3>Types</h3>
2561
<h4><a name="pollable"><code>resource pollable</code></a></h4>
26-
<h2>A &quot;pollable&quot; handle.</h2>
62+
<h2><a href="#pollable"><code>pollable</code></a> epresents a single I/O event which may be ready, or not.</h2>
2763
<h3>Functions</h3>
28-
<h4><a name="poll_list"><code>poll-list: func</code></a></h4>
64+
<h4><a name="method_pollable.ready"><code>[method]pollable.ready: func</code></a></h4>
65+
<p>Return the readiness of a pollable. This function never blocks.</p>
66+
<p>Returns <code>true</code> when the pollable is ready, and <code>false</code> otherwise.</p>
67+
<h5>Params</h5>
68+
<ul>
69+
<li><a name="method_pollable.ready.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
70+
</ul>
71+
<h5>Return values</h5>
72+
<ul>
73+
<li><a name="method_pollable.ready.0"></a> <code>bool</code></li>
74+
</ul>
75+
<h4><a name="method_pollable.block"><code>[method]pollable.block: func</code></a></h4>
76+
<p><code>block</code> returns immediately if the pollable is ready, and otherwise
77+
blocks until ready.</p>
78+
<p>This function is equivalent to calling <code>poll.poll</code> on a list
79+
containing only this pollable.</p>
80+
<h5>Params</h5>
81+
<ul>
82+
<li><a name="method_pollable.block.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
83+
</ul>
84+
<h4><a name="poll"><code>poll: func</code></a></h4>
2985
<p>Poll for completion on a set of pollables.</p>
3086
<p>This function takes a list of pollables, which identify I/O sources of
3187
interest, and waits until one or more of the events is ready for I/O.</p>
@@ -41,40 +97,26 @@ the pollables has an error, it is indicated by marking the source as
4197
being reaedy for I/O.</p>
4298
<h5>Params</h5>
4399
<ul>
44-
<li><a name="poll_list.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
100+
<li><a name="poll.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
45101
</ul>
46102
<h5>Return values</h5>
47103
<ul>
48-
<li><a name="poll_list.0"></a> list&lt;<code>u32</code>&gt;</li>
104+
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
49105
</ul>
50-
<h4><a name="poll_one"><code>poll-one: func</code></a></h4>
51-
<p>Poll for completion on a single pollable.</p>
52-
<p>This function is similar to <a href="#poll_list"><code>poll-list</code></a>, but operates on only a single
53-
pollable. When it returns, the handle is ready for I/O.</p>
54-
<h5>Params</h5>
55-
<ul>
56-
<li><a name="poll_one.in"><code>in</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
57-
</ul>
58-
<h2><a name="wasi:io_streams">Import interface wasi:io/streams</a></h2>
106+
<h2><a name="wasi:io_streams_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
59107
<p>WASI I/O is an I/O abstraction API which is currently focused on providing
60108
stream types.</p>
61109
<p>In the future, the component model is expected to add built-in stream types;
62110
when it does, they are expected to subsume this API.</p>
63111
<hr />
64112
<h3>Types</h3>
65-
<h4><a name="pollable"><code>type pollable</code></a></h4>
66-
<p><a href="#pollable"><a href="#pollable"><code>pollable</code></a></a></p>
113+
<h4><a name="error"><code>type error</code></a></h4>
114+
<p><a href="#error"><a href="#error"><code>error</code></a></a></p>
67115
<p>
68-
#### <a name="error">`resource error`</a>
69-
<p>Contextual error information about the last failure that happened on
70-
a read, write, or flush from an <a href="#input_stream"><code>input-stream</code></a> or <a href="#output_stream"><code>output-stream</code></a>.</p>
71-
<p>This type is returned through the <a href="#stream_error"><code>stream-error</code></a> type whenever an
72-
operation on a stream directly fails or an error is discovered
73-
after-the-fact, for example when a write's failure shows up through a
74-
later <code>flush</code> or <code>check-write</code>.</p>
75-
<p>Interfaces such as <code>wasi:filesystem/types</code> provide functionality to
76-
further &quot;downcast&quot; this error into interface-specific error information.</p>
77-
<h4><a name="stream_error"><code>variant stream-error</code></a></h4>
116+
#### <a name="pollable">`type pollable`</a>
117+
[`pollable`](#pollable)
118+
<p>
119+
#### <a name="stream_error">`variant stream-error`</a>
78120
<p>An error for input-stream and output-stream operations.</p>
79121
<h5>Variant Cases</h5>
80122
<ul>
@@ -97,30 +139,16 @@ platforms. I/O operations always return promptly; if fewer bytes are
97139
promptly available than requested, they return the number of bytes promptly
98140
available, which could even be zero. To wait for data to be available,
99141
use the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be polled
100-
for using <a href="#wasi:io_poll"><code>wasi:io/poll</code></a>.</p>
142+
for using <code>wasi:io/poll</code>.</p>
101143
<h4><a name="output_stream"><code>resource output-stream</code></a></h4>
102144
<p>An output bytestream.</p>
103145
<h2><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
104146
underlying platforms. Except where specified otherwise, I/O operations also
105147
always return promptly, after the number of bytes that can be written
106148
promptly, which could even be zero. To wait for the stream to be ready to
107149
accept data, the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be
108-
polled for using <a href="#wasi:io_poll"><code>wasi:io/poll</code></a>.</h2>
150+
polled for using <code>wasi:io/poll</code>.</h2>
109151
<h3>Functions</h3>
110-
<h4><a name="method_error.to_debug_string"><code>[method]error.to-debug-string: func</code></a></h4>
111-
<p>Returns a string that's suitable to assist humans in debugging this
112-
error.</p>
113-
<p>The returned string will change across platforms and hosts which
114-
means that parsing it, for example, would be a
115-
platform-compatibility hazard.</p>
116-
<h5>Params</h5>
117-
<ul>
118-
<li><a name="method_error.to_debug_string.self"><code>self</code></a>: borrow&lt;<a href="#error"><a href="#error"><code>error</code></a></a>&gt;</li>
119-
</ul>
120-
<h5>Return values</h5>
121-
<ul>
122-
<li><a name="method_error.to_debug_string.0"></a> <code>string</code></li>
123-
</ul>
124152
<h4><a name="method_input_stream.read"><code>[method]input-stream.read: func</code></a></h4>
125153
<p>Perform a non-blocking read from the stream.</p>
126154
<p>This function returns a list of bytes containing the read data,

keyvalue.md

+72-44
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<ul>
33
<li>Imports:
44
<ul>
5-
<li>interface <a href="#wasi:io_poll"><code>wasi:io/poll</code></a></li>
6-
<li>interface <a href="#wasi:io_streams"><code>wasi:io/streams</code></a></li>
5+
<li>interface <a href="#wasi:io_error_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
6+
<li>interface <a href="#wasi:io_poll_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
7+
<li>interface <a href="#wasi:io_streams_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]</code></a></li>
78
<li>interface <a href="#wasi:keyvalue_wasi_cloud_error"><code>wasi:keyvalue/wasi-cloud-error</code></a></li>
89
<li>interface <a href="#wasi:keyvalue_types"><code>wasi:keyvalue/types</code></a></li>
910
<li>interface <a href="#wasi:keyvalue_readwrite"><code>wasi:keyvalue/readwrite</code></a></li>
@@ -12,15 +13,70 @@
1213
</ul>
1314
</li>
1415
</ul>
15-
<h2><a name="wasi:io_poll">Import interface wasi:io/poll</a></h2>
16+
<h2><a name="wasi:io_error_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
17+
<hr />
18+
<h3>Types</h3>
19+
<h4><a name="error"><code>resource error</code></a></h4>
20+
<p>A resource which represents some error information.</p>
21+
<p>The only method provided by this resource is <code>to-debug-string</code>,
22+
which provides some human-readable information about the error.</p>
23+
<p>In the <code>wasi:io</code> package, this resource is returned through the
24+
<code>wasi:io/streams/stream-error</code> type.</p>
25+
<p>To provide more specific error information, other interfaces may
26+
provide functions to further &quot;downcast&quot; this error into more specific
27+
error information. For example, <a href="#error"><code>error</code></a>s returned in streams derived
28+
from filesystem types to be described using the filesystem's own
29+
error-code type, using the function
30+
<code>wasi:filesystem/types/filesystem-error-code</code>, which takes a parameter
31+
<code>borrow&lt;error&gt;</code> and returns
32+
<code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
33+
<h2>The set of functions which can &quot;downcast&quot; an <a href="#error"><code>error</code></a> into a more
34+
concrete type is open.</h2>
35+
<h3>Functions</h3>
36+
<h4><a name="method_error.to_debug_string"><code>[method]error.to-debug-string: func</code></a></h4>
37+
<p>Returns a string that is suitable to assist humans in debugging
38+
this error.</p>
39+
<p>WARNING: The returned string should not be consumed mechanically!
40+
It may change across platforms, hosts, or other implementation
41+
details. Parsing this string is a major platform-compatibility
42+
hazard.</p>
43+
<h5>Params</h5>
44+
<ul>
45+
<li><a name="method_error.to_debug_string.self"><code>self</code></a>: borrow&lt;<a href="#error"><a href="#error"><code>error</code></a></a>&gt;</li>
46+
</ul>
47+
<h5>Return values</h5>
48+
<ul>
49+
<li><a name="method_error.to_debug_string.0"></a> <code>string</code></li>
50+
</ul>
51+
<h2><a name="wasi:io_poll_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
1652
<p>A poll API intended to let users wait for I/O events on multiple handles
1753
at once.</p>
1854
<hr />
1955
<h3>Types</h3>
2056
<h4><a name="pollable"><code>resource pollable</code></a></h4>
21-
<h2>A &quot;pollable&quot; handle.</h2>
57+
<h2><a href="#pollable"><code>pollable</code></a> epresents a single I/O event which may be ready, or not.</h2>
2258
<h3>Functions</h3>
23-
<h4><a name="poll_list"><code>poll-list: func</code></a></h4>
59+
<h4><a name="method_pollable.ready"><code>[method]pollable.ready: func</code></a></h4>
60+
<p>Return the readiness of a pollable. This function never blocks.</p>
61+
<p>Returns <code>true</code> when the pollable is ready, and <code>false</code> otherwise.</p>
62+
<h5>Params</h5>
63+
<ul>
64+
<li><a name="method_pollable.ready.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
65+
</ul>
66+
<h5>Return values</h5>
67+
<ul>
68+
<li><a name="method_pollable.ready.0"></a> <code>bool</code></li>
69+
</ul>
70+
<h4><a name="method_pollable.block"><code>[method]pollable.block: func</code></a></h4>
71+
<p><code>block</code> returns immediately if the pollable is ready, and otherwise
72+
blocks until ready.</p>
73+
<p>This function is equivalent to calling <code>poll.poll</code> on a list
74+
containing only this pollable.</p>
75+
<h5>Params</h5>
76+
<ul>
77+
<li><a name="method_pollable.block.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
78+
</ul>
79+
<h4><a name="poll"><code>poll: func</code></a></h4>
2480
<p>Poll for completion on a set of pollables.</p>
2581
<p>This function takes a list of pollables, which identify I/O sources of
2682
interest, and waits until one or more of the events is ready for I/O.</p>
@@ -36,40 +92,26 @@ the pollables has an error, it is indicated by marking the source as
3692
being reaedy for I/O.</p>
3793
<h5>Params</h5>
3894
<ul>
39-
<li><a name="poll_list.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
95+
<li><a name="poll.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
4096
</ul>
4197
<h5>Return values</h5>
4298
<ul>
43-
<li><a name="poll_list.0"></a> list&lt;<code>u32</code>&gt;</li>
99+
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
44100
</ul>
45-
<h4><a name="poll_one"><code>poll-one: func</code></a></h4>
46-
<p>Poll for completion on a single pollable.</p>
47-
<p>This function is similar to <a href="#poll_list"><code>poll-list</code></a>, but operates on only a single
48-
pollable. When it returns, the handle is ready for I/O.</p>
49-
<h5>Params</h5>
50-
<ul>
51-
<li><a name="poll_one.in"><code>in</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
52-
</ul>
53-
<h2><a name="wasi:io_streams">Import interface wasi:io/streams</a></h2>
101+
<h2><a name="wasi:io_streams_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]</a></h2>
54102
<p>WASI I/O is an I/O abstraction API which is currently focused on providing
55103
stream types.</p>
56104
<p>In the future, the component model is expected to add built-in stream types;
57105
when it does, they are expected to subsume this API.</p>
58106
<hr />
59107
<h3>Types</h3>
60-
<h4><a name="pollable"><code>type pollable</code></a></h4>
61-
<p><a href="#pollable"><a href="#pollable"><code>pollable</code></a></a></p>
108+
<h4><a name="error"><code>type error</code></a></h4>
109+
<p><a href="#error"><a href="#error"><code>error</code></a></a></p>
62110
<p>
63-
#### <a name="error">`resource error`</a>
64-
<p>Contextual error information about the last failure that happened on
65-
a read, write, or flush from an <a href="#input_stream"><code>input-stream</code></a> or <a href="#output_stream"><code>output-stream</code></a>.</p>
66-
<p>This type is returned through the <a href="#stream_error"><code>stream-error</code></a> type whenever an
67-
operation on a stream directly fails or an error is discovered
68-
after-the-fact, for example when a write's failure shows up through a
69-
later <code>flush</code> or <code>check-write</code>.</p>
70-
<p>Interfaces such as <code>wasi:filesystem/types</code> provide functionality to
71-
further &quot;downcast&quot; this error into interface-specific error information.</p>
72-
<h4><a name="stream_error"><code>variant stream-error</code></a></h4>
111+
#### <a name="pollable">`type pollable`</a>
112+
[`pollable`](#pollable)
113+
<p>
114+
#### <a name="stream_error">`variant stream-error`</a>
73115
<p>An error for input-stream and output-stream operations.</p>
74116
<h5>Variant Cases</h5>
75117
<ul>
@@ -92,30 +134,16 @@ platforms. I/O operations always return promptly; if fewer bytes are
92134
promptly available than requested, they return the number of bytes promptly
93135
available, which could even be zero. To wait for data to be available,
94136
use the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be polled
95-
for using <a href="#wasi:io_poll"><code>wasi:io/poll</code></a>.</p>
137+
for using <code>wasi:io/poll</code>.</p>
96138
<h4><a name="output_stream"><code>resource output-stream</code></a></h4>
97139
<p>An output bytestream.</p>
98140
<h2><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
99141
underlying platforms. Except where specified otherwise, I/O operations also
100142
always return promptly, after the number of bytes that can be written
101143
promptly, which could even be zero. To wait for the stream to be ready to
102144
accept data, the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be
103-
polled for using <a href="#wasi:io_poll"><code>wasi:io/poll</code></a>.</h2>
145+
polled for using <code>wasi:io/poll</code>.</h2>
104146
<h3>Functions</h3>
105-
<h4><a name="method_error.to_debug_string"><code>[method]error.to-debug-string: func</code></a></h4>
106-
<p>Returns a string that's suitable to assist humans in debugging this
107-
error.</p>
108-
<p>The returned string will change across platforms and hosts which
109-
means that parsing it, for example, would be a
110-
platform-compatibility hazard.</p>
111-
<h5>Params</h5>
112-
<ul>
113-
<li><a name="method_error.to_debug_string.self"><code>self</code></a>: borrow&lt;<a href="#error"><a href="#error"><code>error</code></a></a>&gt;</li>
114-
</ul>
115-
<h5>Return values</h5>
116-
<ul>
117-
<li><a name="method_error.to_debug_string.0"></a> <code>string</code></li>
118-
</ul>
119147
<h4><a name="method_input_stream.read"><code>[method]input-stream.read: func</code></a></h4>
120148
<p>Perform a non-blocking read from the stream.</p>
121149
<p>This function returns a list of bytes containing the read data,

wit/caching.wit

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Time-to-Live values (within the usual limitations around time in a
1212
// distributed setting).
1313
interface cache {
14-
use wasi:io/poll.{pollable};
14+
use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
1515
use types.{key, incoming-value, outgoing-value, error};
1616

1717
// The `get` operation returns the value passed by a previous `set` for the

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/main.tar.gz"
3-
sha256 = "027671996ef6e3bedd160a6ca6631184cf68d7b36497225316c1726a5d0eb078"
4-
sha512 = "2a3fee2c5acc2091dec45a929ff3d857e75a1970fd64d2f3ce5faad2a0d5fb3df0ad8c5f09a97c1ade8c5986317993058d141a5922b19dfbdaf97041a9bde7aa"
2+
url = "https://github.com/WebAssembly/wasi-io/archive/v0.2.0-rc-2023-11-10.tar.gz"
3+
sha256 = "f2e6127b235c37c06be675a904d6acf08db953ea688d78c42892c6ad3bd194e4"
4+
sha512 = "32feefbc115c34bf6968cb6e9dc15e755698ee90648e5a5d84448917c36a318bd61b401195eb64330e2475e1d098bfb8dee1440d594a68e0797748762bd84ae5"

wit/deps.toml

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

0 commit comments

Comments
 (0)