Skip to content

Commit 74ea247

Browse files
yoshuawuytsricochet
authored andcommitted
v0.2.1
1 parent 061d28f commit 74ea247

File tree

15 files changed

+185
-78
lines changed

15 files changed

+185
-78
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ jobs:
1919
git add -N wit/deps
2020
git diff --exit-code
2121
- uses: WebAssembly/wit-abi-up-to-date@v21
22+
with:
23+
wit-bindgen: '0.28.0'

imports.md

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
<ul>
33
<li>Imports:
44
<ul>
5-
<li>interface <a href="#wasi_sockets_network_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
6-
<li>interface <a href="#wasi_sockets_instance_network_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
7-
<li>interface <a href="#wasi_io_poll_0_2_0"><code>wasi:io/[email protected].0</code></a></li>
8-
<li>interface <a href="#wasi_sockets_udp_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
9-
<li>interface <a href="#wasi_sockets_udp_create_socket_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
10-
<li>interface <a href="#wasi_io_error_0_2_0"><code>wasi:io/[email protected].0</code></a></li>
11-
<li>interface <a href="#wasi_io_streams_0_2_0"><code>wasi:io/[email protected].0</code></a></li>
12-
<li>interface <a href="#wasi_clocks_monotonic_clock_0_2_0"><code>wasi:clocks/[email protected].0</code></a></li>
13-
<li>interface <a href="#wasi_sockets_tcp_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
14-
<li>interface <a href="#wasi_sockets_tcp_create_socket_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
15-
<li>interface <a href="#wasi_sockets_ip_name_lookup_0_2_0"><code>wasi:sockets/[email protected].0</code></a></li>
5+
<li>interface <a href="#wasi_sockets_network_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
6+
<li>interface <a href="#wasi_sockets_instance_network_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
7+
<li>interface <a href="#wasi_io_poll_0_2_1"><code>wasi:io/[email protected].1</code></a></li>
8+
<li>interface <a href="#wasi_sockets_udp_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
9+
<li>interface <a href="#wasi_sockets_udp_create_socket_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
10+
<li>interface <a href="#wasi_io_error_0_2_1"><code>wasi:io/[email protected].1</code></a></li>
11+
<li>interface <a href="#wasi_io_streams_0_2_1"><code>wasi:io/[email protected].1</code></a></li>
12+
<li>interface <a href="#wasi_clocks_monotonic_clock_0_2_1"><code>wasi:clocks/[email protected].1</code></a></li>
13+
<li>interface <a href="#wasi_sockets_tcp_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
14+
<li>interface <a href="#wasi_sockets_tcp_create_socket_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
15+
<li>interface <a href="#wasi_sockets_ip_name_lookup_0_2_1"><code>wasi:sockets/[email protected].1</code></a></li>
1616
</ul>
1717
</li>
1818
</ul>
19-
<h2><a name="wasi_sockets_network_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
19+
<h2><a name="wasi_sockets_network_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
2020
<hr />
2121
<h3>Types</h3>
2222
<h4><a name="network"></a><code>resource network</code></h4>
@@ -209,7 +209,7 @@ supported size.
209209
<li><a name="ip_socket_address.ipv4"></a><code>ipv4</code>: <a href="#ipv4_socket_address"><a href="#ipv4_socket_address"><code>ipv4-socket-address</code></a></a></li>
210210
<li><a name="ip_socket_address.ipv6"></a><code>ipv6</code>: <a href="#ipv6_socket_address"><a href="#ipv6_socket_address"><code>ipv6-socket-address</code></a></a></li>
211211
</ul>
212-
<h2><a name="wasi_sockets_instance_network_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
212+
<h2><a name="wasi_sockets_instance_network_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
213213
<p>This interface provides a value-export of the default network handle..</p>
214214
<hr />
215215
<h3>Types</h3>
@@ -224,7 +224,7 @@ supported size.
224224
<ul>
225225
<li><a name="instance_network.0"></a> own&lt;<a href="#network"><a href="#network"><code>network</code></a></a>&gt;</li>
226226
</ul>
227-
<h2><a name="wasi_io_poll_0_2_0"></a>Import interface wasi:io/[email protected].0</h2>
227+
<h2><a name="wasi_io_poll_0_2_1"></a>Import interface wasi:io/[email protected].1</h2>
228228
<p>A poll API intended to let users wait for I/O events on multiple handles
229229
at once.</p>
230230
<hr />
@@ -258,14 +258,17 @@ containing only this pollable.</p>
258258
interest, and waits until one or more of the events is ready for I/O.</p>
259259
<p>The result <code>list&lt;u32&gt;</code> contains one or more indices of handles in the
260260
argument list that is ready for I/O.</p>
261-
<p>If the list contains more elements than can be indexed with a <code>u32</code>
262-
value, this function traps.</p>
261+
<p>This function traps if either:</p>
262+
<ul>
263+
<li>the list is empty, or:</li>
264+
<li>the list contains more elements than can be indexed with a <code>u32</code> value.</li>
265+
</ul>
263266
<p>A timeout can be implemented by adding a pollable from the
264267
wasi-clocks API to the list.</p>
265268
<p>This function does not return a <code>result</code>; polling in itself does not
266269
do any I/O so it doesn't fail. If any of the I/O sources identified by
267270
the pollables has an error, it is indicated by marking the source as
268-
being reaedy for I/O.</p>
271+
being ready for I/O.</p>
269272
<h5>Params</h5>
270273
<ul>
271274
<li><a name="poll.in"></a><code>in</code>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
@@ -274,7 +277,7 @@ being reaedy for I/O.</p>
274277
<ul>
275278
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
276279
</ul>
277-
<h2><a name="wasi_sockets_udp_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
280+
<h2><a name="wasi_sockets_udp_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
278281
<hr />
279282
<h3>Types</h3>
280283
<h4><a name="pollable"></a><code>type pollable</code></h4>
@@ -688,7 +691,7 @@ It's planned to be removed when <code>future</code> is natively supported in Pre
688691
<ul>
689692
<li><a name="method_outgoing_datagram_stream_subscribe.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
690693
</ul>
691-
<h2><a name="wasi_sockets_udp_create_socket_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
694+
<h2><a name="wasi_sockets_udp_create_socket_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
692695
<hr />
693696
<h3>Types</h3>
694697
<h4><a name="network"></a><code>type network</code></h4>
@@ -733,7 +736,7 @@ the socket is effectively an in-memory configuration object, unable to communica
733736
<ul>
734737
<li><a name="create_udp_socket.0"></a> result&lt;own&lt;<a href="#udp_socket"><a href="#udp_socket"><code>udp-socket</code></a></a>&gt;, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
735738
</ul>
736-
<h2><a name="wasi_io_error_0_2_0"></a>Import interface wasi:io/[email protected].0</h2>
739+
<h2><a name="wasi_io_error_0_2_1"></a>Import interface wasi:io/[email protected].1</h2>
737740
<hr />
738741
<h3>Types</h3>
739742
<h4><a name="error"></a><code>resource error</code></h4>
@@ -743,13 +746,11 @@ which provides some human-readable information about the error.</p>
743746
<p>In the <code>wasi:io</code> package, this resource is returned through the
744747
<code>wasi:io/streams/stream-error</code> type.</p>
745748
<p>To provide more specific error information, other interfaces may
746-
provide functions to further &quot;downcast&quot; this error into more specific
747-
error information. For example, <a href="#error"><code>error</code></a>s returned in streams derived
748-
from filesystem types to be described using the filesystem's own
749-
error-code type, using the function
750-
<code>wasi:filesystem/types/filesystem-error-code</code>, which takes a parameter
751-
<code>borrow&lt;error&gt;</code> and returns
752-
<code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
749+
offer functions to &quot;downcast&quot; this error into more specific types. For example,
750+
errors returned from streams derived from filesystem types can be described using
751+
the filesystem's own error-code type. This is done using the function
752+
<code>wasi:filesystem/types/filesystem-error-code</code>, which takes a <code>borrow&lt;error&gt;</code>
753+
parameter and returns an <code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
753754
<h2>The set of functions which can &quot;downcast&quot; an <a href="#error"><code>error</code></a> into a more
754755
concrete type is open.</h2>
755756
<h3>Functions</h3>
@@ -768,7 +769,7 @@ hazard.</p>
768769
<ul>
769770
<li><a name="method_error_to_debug_string.0"></a> <code>string</code></li>
770771
</ul>
771-
<h2><a name="wasi_io_streams_0_2_0"></a>Import interface wasi:io/[email protected].0</h2>
772+
<h2><a name="wasi_io_streams_0_2_1"></a>Import interface wasi:io/[email protected].1</h2>
772773
<p>WASI I/O is an I/O abstraction API which is currently focused on providing
773774
stream types.</p>
774775
<p>In the future, the component model is expected to add built-in stream types;
@@ -807,12 +808,15 @@ use the <code>subscribe</code> function to obtain a <a href="#pollable"><code>po
807808
for using <code>wasi:io/poll</code>.</p>
808809
<h4><a name="output_stream"></a><code>resource output-stream</code></h4>
809810
<p>An output bytestream.</p>
810-
<h2><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
811+
<p><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
811812
underlying platforms. Except where specified otherwise, I/O operations also
812813
always return promptly, after the number of bytes that can be written
813814
promptly, which could even be zero. To wait for the stream to be ready to
814815
accept data, the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be
815-
polled for using <code>wasi:io/poll</code>.</h2>
816+
polled for using <code>wasi:io/poll</code>.</p>
817+
<h2>Dropping an <a href="#output_stream"><code>output-stream</code></a> while there's still an active write in
818+
progress may result in the data being lost. Before dropping the stream,
819+
be sure to fully flush your writes.</h2>
816820
<h3>Functions</h3>
817821
<h4><a name="method_input_stream_read"></a><code>[method]input-stream.read: func</code></h4>
818822
<p>Perform a non-blocking read from the stream.</p>
@@ -994,7 +998,7 @@ and stream is ready for writing again.</p>
994998
</ul>
995999
<h4><a name="method_output_stream_subscribe"></a><code>[method]output-stream.subscribe: func</code></h4>
9961000
<p>Create a <a href="#pollable"><code>pollable</code></a> which will resolve once the output-stream
997-
is ready for more writing, or an error has occured. When this
1001+
is ready for more writing, or an error has occurred. When this
9981002
pollable is ready, <code>check-write</code> will return <code>ok(n)</code> with n&gt;0, or an
9991003
error.</p>
10001004
<p>If the stream is closed, this pollable is always ready immediately.</p>
@@ -1057,7 +1061,7 @@ let _ = this.check-write(); // eliding error handling
10571061
</ul>
10581062
<h4><a name="method_output_stream_splice"></a><code>[method]output-stream.splice: func</code></h4>
10591063
<p>Read from one stream and write to another.</p>
1060-
<p>The behavior of splice is equivelant to:</p>
1064+
<p>The behavior of splice is equivalent to:</p>
10611065
<ol>
10621066
<li>calling <code>check-write</code> on the <a href="#output_stream"><code>output-stream</code></a></li>
10631067
<li>calling <code>read</code> on the <a href="#input_stream"><code>input-stream</code></a> with the smaller of the
@@ -1093,14 +1097,13 @@ is ready for reading, before performing the <code>splice</code>.</p>
10931097
<ul>
10941098
<li><a name="method_output_stream_blocking_splice.0"></a> result&lt;<code>u64</code>, <a href="#stream_error"><a href="#stream_error"><code>stream-error</code></a></a>&gt;</li>
10951099
</ul>
1096-
<h2><a name="wasi_clocks_monotonic_clock_0_2_0"></a>Import interface wasi:clocks/[email protected].0</h2>
1100+
<h2><a name="wasi_clocks_monotonic_clock_0_2_1"></a>Import interface wasi:clocks/[email protected].1</h2>
10971101
<p>WASI Monotonic Clock is a clock API intended to let users measure elapsed
10981102
time.</p>
10991103
<p>It is intended to be portable at least between Unix-family platforms and
11001104
Windows.</p>
11011105
<p>A monotonic clock is a clock which has an unspecified initial value, and
11021106
successive reads of the clock will produce non-decreasing values.</p>
1103-
<p>It is intended for measuring elapsed time.</p>
11041107
<hr />
11051108
<h3>Types</h3>
11061109
<h4><a name="pollable"></a><code>type pollable</code></h4>
@@ -1133,7 +1136,7 @@ corresponding to a clock tick.</p>
11331136
</ul>
11341137
<h4><a name="subscribe_instant"></a><code>subscribe-instant: func</code></h4>
11351138
<p>Create a <a href="#pollable"><code>pollable</code></a> which will resolve once the specified instant
1136-
occured.</p>
1139+
has occurred.</p>
11371140
<h5>Params</h5>
11381141
<ul>
11391142
<li><a name="subscribe_instant.when"></a><code>when</code>: <a href="#instant"><a href="#instant"><code>instant</code></a></a></li>
@@ -1143,9 +1146,8 @@ occured.</p>
11431146
<li><a name="subscribe_instant.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
11441147
</ul>
11451148
<h4><a name="subscribe_duration"></a><code>subscribe-duration: func</code></h4>
1146-
<p>Create a <a href="#pollable"><code>pollable</code></a> which will resolve once the given duration has
1147-
elapsed, starting at the time at which this function was called.
1148-
occured.</p>
1149+
<p>Create a <a href="#pollable"><code>pollable</code></a> that will resolve after the specified duration has
1150+
elapsed from the time this function is invoked.</p>
11491151
<h5>Params</h5>
11501152
<ul>
11511153
<li><a name="subscribe_duration.when"></a><code>when</code>: <a href="#duration"><a href="#duration"><code>duration</code></a></a></li>
@@ -1154,7 +1156,7 @@ occured.</p>
11541156
<ul>
11551157
<li><a name="subscribe_duration.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
11561158
</ul>
1157-
<h2><a name="wasi_sockets_tcp_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
1159+
<h2><a name="wasi_sockets_tcp_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
11581160
<hr />
11591161
<h3>Types</h3>
11601162
<h4><a name="input_stream"></a><code>type input-stream</code></h4>
@@ -1745,7 +1747,7 @@ has no effect and returns <code>ok</code>.</p>
17451747
<ul>
17461748
<li><a name="method_tcp_socket_shutdown.0"></a> result&lt;_, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
17471749
</ul>
1748-
<h2><a name="wasi_sockets_tcp_create_socket_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
1750+
<h2><a name="wasi_sockets_tcp_create_socket_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
17491751
<hr />
17501752
<h3>Types</h3>
17511753
<h4><a name="network"></a><code>type network</code></h4>
@@ -1790,7 +1792,7 @@ is called, the socket is effectively an in-memory configuration object, unable t
17901792
<ul>
17911793
<li><a name="create_tcp_socket.0"></a> result&lt;own&lt;<a href="#tcp_socket"><a href="#tcp_socket"><code>tcp-socket</code></a></a>&gt;, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
17921794
</ul>
1793-
<h2><a name="wasi_sockets_ip_name_lookup_0_2_0"></a>Import interface wasi:sockets/[email protected].0</h2>
1795+
<h2><a name="wasi_sockets_ip_name_lookup_0_2_1"></a>Import interface wasi:sockets/[email protected].1</h2>
17941796
<hr />
17951797
<h3>Types</h3>
17961798
<h4><a name="pollable"></a><code>type pollable</code></h4>

wit/deps.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[clocks]
22
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
3-
sha256 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
4-
sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"
3+
sha256 = "ea9d69ee803bc176e23e5268f5e24a2ac485dd1f62a0ab4c748e9d3f901f576f"
4+
sha512 = "5efc22927c46cd56c41e5549ec775561c7fac2ea0d365abc0b55396d9475a7c9f984077a81f84a44a726f1c008fd2fadbffffa4fa53ecd5fbfd05afd379ab428"
55

66
[io]
77
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
8-
sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
9-
sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"
8+
sha256 = "2a74bd811adc46b5a0f19827ddbde89870e52b17615f4d0873f06fd977250caf"
9+
sha512 = "94624f00c66e66203592cee820f80b1ba91ecdb71f682c154f25eaf71f8d8954197dcb64503bc21e72ed5e812af7eae876df47b7eb727b02db3a74a7ce0aefca"

wit/deps/clocks/monotonic-clock.wit

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0;
1+
package wasi:clocks@0.2.1;
22
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
33
/// time.
44
///
@@ -7,38 +7,43 @@ package wasi:[email protected];
77
///
88
/// A monotonic clock is a clock which has an unspecified initial value, and
99
/// successive reads of the clock will produce non-decreasing values.
10-
///
11-
/// It is intended for measuring elapsed time.
10+
@since(version = 0.2.0)
1211
interface monotonic-clock {
13-
use wasi:io/poll@0.2.0.{pollable};
12+
@since(version = 0.2.0)
13+
use wasi:io/poll@0.2.1.{pollable};
1414

1515
/// An instant in time, in nanoseconds. An instant is relative to an
1616
/// unspecified initial value, and can only be compared to instances from
1717
/// the same monotonic-clock.
18+
@since(version = 0.2.0)
1819
type instant = u64;
1920

2021
/// A duration of time, in nanoseconds.
22+
@since(version = 0.2.0)
2123
type duration = u64;
2224

2325
/// Read the current value of the clock.
2426
///
2527
/// The clock is monotonic, therefore calling this function repeatedly will
2628
/// produce a sequence of non-decreasing values.
29+
@since(version = 0.2.0)
2730
now: func() -> instant;
2831

2932
/// Query the resolution of the clock. Returns the duration of time
3033
/// corresponding to a clock tick.
34+
@since(version = 0.2.0)
3135
resolution: func() -> duration;
3236

3337
/// Create a `pollable` which will resolve once the specified instant
34-
/// occured.
38+
/// has occurred.
39+
@since(version = 0.2.0)
3540
subscribe-instant: func(
3641
when: instant,
3742
) -> pollable;
3843

39-
/// Create a `pollable` which will resolve once the given duration has
40-
/// elapsed, starting at the time at which this function was called.
41-
/// occured.
44+
/// Create a `pollable` that will resolve after the specified duration has
45+
/// elapsed from the time this function is invoked.
46+
@since(version = 0.2.0)
4247
subscribe-duration: func(
4348
when: duration,
4449
) -> pollable;

wit/deps/clocks/timezone.wit

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package wasi:clocks@0.2.1;
2+
3+
@unstable(feature = clocks-timezone)
4+
interface timezone {
5+
@unstable(feature = clocks-timezone)
6+
use wall-clock.{datetime};
7+
8+
/// Return information needed to display the given `datetime`. This includes
9+
/// the UTC offset, the time zone name, and a flag indicating whether
10+
/// daylight saving time is active.
11+
///
12+
/// If the timezone cannot be determined for the given `datetime`, return a
13+
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
14+
/// saving time.
15+
@unstable(feature = clocks-timezone)
16+
display: func(when: datetime) -> timezone-display;
17+
18+
/// The same as `display`, but only return the UTC offset.
19+
@unstable(feature = clocks-timezone)
20+
utc-offset: func(when: datetime) -> s32;
21+
22+
/// Information useful for displaying the timezone of a specific `datetime`.
23+
///
24+
/// This information may vary within a single `timezone` to reflect daylight
25+
/// saving time adjustments.
26+
@unstable(feature = clocks-timezone)
27+
record timezone-display {
28+
/// The number of seconds difference between UTC time and the local
29+
/// time of the timezone.
30+
///
31+
/// The returned value will always be less than 86400 which is the
32+
/// number of seconds in a day (24*60*60).
33+
///
34+
/// In implementations that do not expose an actual time zone, this
35+
/// should return 0.
36+
utc-offset: s32,
37+
38+
/// The abbreviated name of the timezone to display to a user. The name
39+
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
40+
/// reference local standards for the name of the time zone.
41+
///
42+
/// In implementations that do not expose an actual time zone, this
43+
/// should be the string `UTC`.
44+
///
45+
/// In time zones that do not have an applicable name, a formatted
46+
/// representation of the UTC offset may be returned, such as `-04:00`.
47+
name: string,
48+
49+
/// Whether daylight saving time is active.
50+
///
51+
/// In implementations that do not expose an actual time zone, this
52+
/// should return false.
53+
in-daylight-saving-time: bool,
54+
}
55+
}

0 commit comments

Comments
 (0)