Skip to content

Commit b8fdd99

Browse files
authored
Change wasi:clocks from include to import in wasi:http/proxy (#115)
* Change `wasi:clocks` from `include` to `import` * gen docs
1 parent d8a669d commit b8fdd99

File tree

3 files changed

+201
-199
lines changed

3 files changed

+201
-199
lines changed

imports.md

+156-156
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,173 @@ It is intended to be <code>include</code>d in other worlds.</p>
44
<ul>
55
<li>Imports:
66
<ul>
7+
<li>interface <a href="#wasi_io_poll_0_2_0"><code>wasi:io/[email protected]</code></a></li>
8+
<li>interface <a href="#wasi_clocks_monotonic_clock_0_2_0"><code>wasi:clocks/[email protected]</code></a></li>
9+
<li>interface <a href="#wasi_clocks_wall_clock_0_2_0"><code>wasi:clocks/[email protected]</code></a></li>
710
<li>interface <a href="#wasi_random_random_0_2_0"><code>wasi:random/[email protected]</code></a></li>
811
<li>interface <a href="#wasi_io_error_0_2_0"><code>wasi:io/[email protected]</code></a></li>
9-
<li>interface <a href="#wasi_io_poll_0_2_0"><code>wasi:io/[email protected]</code></a></li>
1012
<li>interface <a href="#wasi_io_streams_0_2_0"><code>wasi:io/[email protected]</code></a></li>
1113
<li>interface <a href="#wasi_cli_stdout_0_2_0"><code>wasi:cli/[email protected]</code></a></li>
1214
<li>interface <a href="#wasi_cli_stderr_0_2_0"><code>wasi:cli/[email protected]</code></a></li>
1315
<li>interface <a href="#wasi_cli_stdin_0_2_0"><code>wasi:cli/[email protected]</code></a></li>
14-
<li>interface <a href="#wasi_clocks_monotonic_clock_0_2_0"><code>wasi:clocks/[email protected]</code></a></li>
1516
<li>interface <a href="#wasi_http_types_0_2_0"><code>wasi:http/[email protected]</code></a></li>
1617
<li>interface <a href="#wasi_http_outgoing_handler_0_2_0"><code>wasi:http/[email protected]</code></a></li>
17-
<li>interface <a href="#wasi_clocks_wall_clock_0_2_0"><code>wasi:clocks/[email protected]</code></a></li>
1818
</ul>
1919
</li>
2020
</ul>
21+
<h2><a name="wasi_io_poll_0_2_0"></a>Import interface wasi:io/[email protected]</h2>
22+
<p>A poll API intended to let users wait for I/O events on multiple handles
23+
at once.</p>
24+
<hr />
25+
<h3>Types</h3>
26+
<h4><a name="pollable"></a><code>resource pollable</code></h4>
27+
<h2><a href="#pollable"><code>pollable</code></a> represents a single I/O event which may be ready, or not.</h2>
28+
<h3>Functions</h3>
29+
<h4><a name="method_pollable_ready"></a><code>[method]pollable.ready: func</code></h4>
30+
<p>Return the readiness of a pollable. This function never blocks.</p>
31+
<p>Returns <code>true</code> when the pollable is ready, and <code>false</code> otherwise.</p>
32+
<h5>Params</h5>
33+
<ul>
34+
<li><a name="method_pollable_ready.self"></a><code>self</code>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
35+
</ul>
36+
<h5>Return values</h5>
37+
<ul>
38+
<li><a name="method_pollable_ready.0"></a> <code>bool</code></li>
39+
</ul>
40+
<h4><a name="method_pollable_block"></a><code>[method]pollable.block: func</code></h4>
41+
<p><code>block</code> returns immediately if the pollable is ready, and otherwise
42+
blocks until ready.</p>
43+
<p>This function is equivalent to calling <code>poll.poll</code> on a list
44+
containing only this pollable.</p>
45+
<h5>Params</h5>
46+
<ul>
47+
<li><a name="method_pollable_block.self"></a><code>self</code>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
48+
</ul>
49+
<h4><a name="poll"></a><code>poll: func</code></h4>
50+
<p>Poll for completion on a set of pollables.</p>
51+
<p>This function takes a list of pollables, which identify I/O sources of
52+
interest, and waits until one or more of the events is ready for I/O.</p>
53+
<p>The result <code>list&lt;u32&gt;</code> contains one or more indices of handles in the
54+
argument list that is ready for I/O.</p>
55+
<p>This function traps if either:</p>
56+
<ul>
57+
<li>the list is empty, or:</li>
58+
<li>the list contains more elements than can be indexed with a <code>u32</code> value.</li>
59+
</ul>
60+
<p>A timeout can be implemented by adding a pollable from the
61+
wasi-clocks API to the list.</p>
62+
<p>This function does not return a <code>result</code>; polling in itself does not
63+
do any I/O so it doesn't fail. If any of the I/O sources identified by
64+
the pollables has an error, it is indicated by marking the source as
65+
being ready for I/O.</p>
66+
<h5>Params</h5>
67+
<ul>
68+
<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>
69+
</ul>
70+
<h5>Return values</h5>
71+
<ul>
72+
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
73+
</ul>
74+
<h2><a name="wasi_clocks_monotonic_clock_0_2_0"></a>Import interface wasi:clocks/[email protected]</h2>
75+
<p>WASI Monotonic Clock is a clock API intended to let users measure elapsed
76+
time.</p>
77+
<p>It is intended to be portable at least between Unix-family platforms and
78+
Windows.</p>
79+
<p>A monotonic clock is a clock which has an unspecified initial value, and
80+
successive reads of the clock will produce non-decreasing values.</p>
81+
<hr />
82+
<h3>Types</h3>
83+
<h4><a name="pollable"></a><code>type pollable</code></h4>
84+
<p><a href="#pollable"><a href="#pollable"><code>pollable</code></a></a></p>
85+
<p>
86+
#### <a name="instant"></a>`type instant`
87+
`u64`
88+
<p>An instant in time, in nanoseconds. An instant is relative to an
89+
unspecified initial value, and can only be compared to instances from
90+
the same monotonic-clock.
91+
<h4><a name="duration"></a><code>type duration</code></h4>
92+
<p><code>u64</code></p>
93+
<p>A duration of time, in nanoseconds.
94+
<hr />
95+
<h3>Functions</h3>
96+
<h4><a name="now"></a><code>now: func</code></h4>
97+
<p>Read the current value of the clock.</p>
98+
<p>The clock is monotonic, therefore calling this function repeatedly will
99+
produce a sequence of non-decreasing values.</p>
100+
<h5>Return values</h5>
101+
<ul>
102+
<li><a name="now.0"></a> <a href="#instant"><a href="#instant"><code>instant</code></a></a></li>
103+
</ul>
104+
<h4><a name="resolution"></a><code>resolution: func</code></h4>
105+
<p>Query the resolution of the clock. Returns the duration of time
106+
corresponding to a clock tick.</p>
107+
<h5>Return values</h5>
108+
<ul>
109+
<li><a name="resolution.0"></a> <a href="#duration"><a href="#duration"><code>duration</code></a></a></li>
110+
</ul>
111+
<h4><a name="subscribe_instant"></a><code>subscribe-instant: func</code></h4>
112+
<p>Create a <a href="#pollable"><code>pollable</code></a> which will resolve once the specified instant
113+
has occurred.</p>
114+
<h5>Params</h5>
115+
<ul>
116+
<li><a name="subscribe_instant.when"></a><code>when</code>: <a href="#instant"><a href="#instant"><code>instant</code></a></a></li>
117+
</ul>
118+
<h5>Return values</h5>
119+
<ul>
120+
<li><a name="subscribe_instant.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
121+
</ul>
122+
<h4><a name="subscribe_duration"></a><code>subscribe-duration: func</code></h4>
123+
<p>Create a <a href="#pollable"><code>pollable</code></a> that will resolve after the specified duration has
124+
elapsed from the time this function is invoked.</p>
125+
<h5>Params</h5>
126+
<ul>
127+
<li><a name="subscribe_duration.when"></a><code>when</code>: <a href="#duration"><a href="#duration"><code>duration</code></a></a></li>
128+
</ul>
129+
<h5>Return values</h5>
130+
<ul>
131+
<li><a name="subscribe_duration.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
132+
</ul>
133+
<h2><a name="wasi_clocks_wall_clock_0_2_0"></a>Import interface wasi:clocks/[email protected]</h2>
134+
<p>WASI Wall Clock is a clock API intended to let users query the current
135+
time. The name &quot;wall&quot; makes an analogy to a &quot;clock on the wall&quot;, which
136+
is not necessarily monotonic as it may be reset.</p>
137+
<p>It is intended to be portable at least between Unix-family platforms and
138+
Windows.</p>
139+
<p>A wall clock is a clock which measures the date and time according to
140+
some external reference.</p>
141+
<p>External references may be reset, so this clock is not necessarily
142+
monotonic, making it unsuitable for measuring elapsed time.</p>
143+
<p>It is intended for reporting the current date and time for humans.</p>
144+
<hr />
145+
<h3>Types</h3>
146+
<h4><a name="datetime"></a><code>record datetime</code></h4>
147+
<p>A time and date in seconds plus nanoseconds.</p>
148+
<h5>Record Fields</h5>
149+
<ul>
150+
<li><a name="datetime.seconds"></a><code>seconds</code>: <code>u64</code></li>
151+
<li><a name="datetime.nanoseconds"></a><code>nanoseconds</code>: <code>u32</code></li>
152+
</ul>
153+
<hr />
154+
<h3>Functions</h3>
155+
<h4><a name="now"></a><code>now: func</code></h4>
156+
<p>Read the current value of the clock.</p>
157+
<p>This clock is not monotonic, therefore calling this function repeatedly
158+
will not necessarily produce a sequence of non-decreasing values.</p>
159+
<p>The returned timestamps represent the number of seconds since
160+
1970-01-01T00:00:00Z, also known as <a href="https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16">POSIX's Seconds Since the Epoch</a>,
161+
also known as <a href="https://en.wikipedia.org/wiki/Unix_time">Unix Time</a>.</p>
162+
<p>The nanoseconds field of the output is always less than 1000000000.</p>
163+
<h5>Return values</h5>
164+
<ul>
165+
<li><a name="now.0"></a> <a href="#datetime"><a href="#datetime"><code>datetime</code></a></a></li>
166+
</ul>
167+
<h4><a name="resolution"></a><code>resolution: func</code></h4>
168+
<p>Query the resolution of the clock.</p>
169+
<p>The nanoseconds field of the output is always less than 1000000000.</p>
170+
<h5>Return values</h5>
171+
<ul>
172+
<li><a name="resolution.0"></a> <a href="#datetime"><a href="#datetime"><code>datetime</code></a></a></li>
173+
</ul>
21174
<h2><a name="wasi_random_random_0_2_0"></a>Import interface wasi:random/[email protected]</h2>
22175
<p>WASI Random is a random data API.</p>
23176
<p>It is intended to be portable at least between Unix-family platforms and
@@ -84,59 +237,6 @@ hazard.</p>
84237
<ul>
85238
<li><a name="method_error_to_debug_string.0"></a> <code>string</code></li>
86239
</ul>
87-
<h2><a name="wasi_io_poll_0_2_0"></a>Import interface wasi:io/[email protected]</h2>
88-
<p>A poll API intended to let users wait for I/O events on multiple handles
89-
at once.</p>
90-
<hr />
91-
<h3>Types</h3>
92-
<h4><a name="pollable"></a><code>resource pollable</code></h4>
93-
<h2><a href="#pollable"><code>pollable</code></a> represents a single I/O event which may be ready, or not.</h2>
94-
<h3>Functions</h3>
95-
<h4><a name="method_pollable_ready"></a><code>[method]pollable.ready: func</code></h4>
96-
<p>Return the readiness of a pollable. This function never blocks.</p>
97-
<p>Returns <code>true</code> when the pollable is ready, and <code>false</code> otherwise.</p>
98-
<h5>Params</h5>
99-
<ul>
100-
<li><a name="method_pollable_ready.self"></a><code>self</code>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
101-
</ul>
102-
<h5>Return values</h5>
103-
<ul>
104-
<li><a name="method_pollable_ready.0"></a> <code>bool</code></li>
105-
</ul>
106-
<h4><a name="method_pollable_block"></a><code>[method]pollable.block: func</code></h4>
107-
<p><code>block</code> returns immediately if the pollable is ready, and otherwise
108-
blocks until ready.</p>
109-
<p>This function is equivalent to calling <code>poll.poll</code> on a list
110-
containing only this pollable.</p>
111-
<h5>Params</h5>
112-
<ul>
113-
<li><a name="method_pollable_block.self"></a><code>self</code>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
114-
</ul>
115-
<h4><a name="poll"></a><code>poll: func</code></h4>
116-
<p>Poll for completion on a set of pollables.</p>
117-
<p>This function takes a list of pollables, which identify I/O sources of
118-
interest, and waits until one or more of the events is ready for I/O.</p>
119-
<p>The result <code>list&lt;u32&gt;</code> contains one or more indices of handles in the
120-
argument list that is ready for I/O.</p>
121-
<p>This function traps if either:</p>
122-
<ul>
123-
<li>the list is empty, or:</li>
124-
<li>the list contains more elements than can be indexed with a <code>u32</code> value.</li>
125-
</ul>
126-
<p>A timeout can be implemented by adding a pollable from the
127-
wasi-clocks API to the list.</p>
128-
<p>This function does not return a <code>result</code>; polling in itself does not
129-
do any I/O so it doesn't fail. If any of the I/O sources identified by
130-
the pollables has an error, it is indicated by marking the source as
131-
being ready for I/O.</p>
132-
<h5>Params</h5>
133-
<ul>
134-
<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>
135-
</ul>
136-
<h5>Return values</h5>
137-
<ul>
138-
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
139-
</ul>
140240
<h2><a name="wasi_io_streams_0_2_0"></a>Import interface wasi:io/[email protected]</h2>
141241
<p>WASI I/O is an I/O abstraction API which is currently focused on providing
142242
stream types.</p>
@@ -504,65 +604,6 @@ is ready for reading, before performing the <code>splice</code>.</p>
504604
<ul>
505605
<li><a name="get_stdin.0"></a> own&lt;<a href="#input_stream"><a href="#input_stream"><code>input-stream</code></a></a>&gt;</li>
506606
</ul>
507-
<h2><a name="wasi_clocks_monotonic_clock_0_2_0"></a>Import interface wasi:clocks/[email protected]</h2>
508-
<p>WASI Monotonic Clock is a clock API intended to let users measure elapsed
509-
time.</p>
510-
<p>It is intended to be portable at least between Unix-family platforms and
511-
Windows.</p>
512-
<p>A monotonic clock is a clock which has an unspecified initial value, and
513-
successive reads of the clock will produce non-decreasing values.</p>
514-
<hr />
515-
<h3>Types</h3>
516-
<h4><a name="pollable"></a><code>type pollable</code></h4>
517-
<p><a href="#pollable"><a href="#pollable"><code>pollable</code></a></a></p>
518-
<p>
519-
#### <a name="instant"></a>`type instant`
520-
`u64`
521-
<p>An instant in time, in nanoseconds. An instant is relative to an
522-
unspecified initial value, and can only be compared to instances from
523-
the same monotonic-clock.
524-
<h4><a name="duration"></a><code>type duration</code></h4>
525-
<p><code>u64</code></p>
526-
<p>A duration of time, in nanoseconds.
527-
<hr />
528-
<h3>Functions</h3>
529-
<h4><a name="now"></a><code>now: func</code></h4>
530-
<p>Read the current value of the clock.</p>
531-
<p>The clock is monotonic, therefore calling this function repeatedly will
532-
produce a sequence of non-decreasing values.</p>
533-
<h5>Return values</h5>
534-
<ul>
535-
<li><a name="now.0"></a> <a href="#instant"><a href="#instant"><code>instant</code></a></a></li>
536-
</ul>
537-
<h4><a name="resolution"></a><code>resolution: func</code></h4>
538-
<p>Query the resolution of the clock. Returns the duration of time
539-
corresponding to a clock tick.</p>
540-
<h5>Return values</h5>
541-
<ul>
542-
<li><a name="resolution.0"></a> <a href="#duration"><a href="#duration"><code>duration</code></a></a></li>
543-
</ul>
544-
<h4><a name="subscribe_instant"></a><code>subscribe-instant: func</code></h4>
545-
<p>Create a <a href="#pollable"><code>pollable</code></a> which will resolve once the specified instant
546-
has occurred.</p>
547-
<h5>Params</h5>
548-
<ul>
549-
<li><a name="subscribe_instant.when"></a><code>when</code>: <a href="#instant"><a href="#instant"><code>instant</code></a></a></li>
550-
</ul>
551-
<h5>Return values</h5>
552-
<ul>
553-
<li><a name="subscribe_instant.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
554-
</ul>
555-
<h4><a name="subscribe_duration"></a><code>subscribe-duration: func</code></h4>
556-
<p>Create a <a href="#pollable"><code>pollable</code></a> that will resolve after the specified duration has
557-
elapsed from the time this function is invoked.</p>
558-
<h5>Params</h5>
559-
<ul>
560-
<li><a name="subscribe_duration.when"></a><code>when</code>: <a href="#duration"><a href="#duration"><code>duration</code></a></a></li>
561-
</ul>
562-
<h5>Return values</h5>
563-
<ul>
564-
<li><a name="subscribe_duration.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
565-
</ul>
566607
<h2><a name="wasi_http_types_0_2_0"></a>Import interface wasi:http/[email protected]</h2>
567608
<p>This interface defines all of the types and methods for implementing
568609
HTTP Requests and Responses, both incoming and outgoing, as well as
@@ -1490,44 +1531,3 @@ through the <a href="#future_incoming_response"><code>future-incoming-response</
14901531
<ul>
14911532
<li><a name="handle.0"></a> result&lt;own&lt;<a href="#future_incoming_response"><a href="#future_incoming_response"><code>future-incoming-response</code></a></a>&gt;, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
14921533
</ul>
1493-
<h2><a name="wasi_clocks_wall_clock_0_2_0"></a>Import interface wasi:clocks/[email protected]</h2>
1494-
<p>WASI Wall Clock is a clock API intended to let users query the current
1495-
time. The name &quot;wall&quot; makes an analogy to a &quot;clock on the wall&quot;, which
1496-
is not necessarily monotonic as it may be reset.</p>
1497-
<p>It is intended to be portable at least between Unix-family platforms and
1498-
Windows.</p>
1499-
<p>A wall clock is a clock which measures the date and time according to
1500-
some external reference.</p>
1501-
<p>External references may be reset, so this clock is not necessarily
1502-
monotonic, making it unsuitable for measuring elapsed time.</p>
1503-
<p>It is intended for reporting the current date and time for humans.</p>
1504-
<hr />
1505-
<h3>Types</h3>
1506-
<h4><a name="datetime"></a><code>record datetime</code></h4>
1507-
<p>A time and date in seconds plus nanoseconds.</p>
1508-
<h5>Record Fields</h5>
1509-
<ul>
1510-
<li><a name="datetime.seconds"></a><code>seconds</code>: <code>u64</code></li>
1511-
<li><a name="datetime.nanoseconds"></a><code>nanoseconds</code>: <code>u32</code></li>
1512-
</ul>
1513-
<hr />
1514-
<h3>Functions</h3>
1515-
<h4><a name="now"></a><code>now: func</code></h4>
1516-
<p>Read the current value of the clock.</p>
1517-
<p>This clock is not monotonic, therefore calling this function repeatedly
1518-
will not necessarily produce a sequence of non-decreasing values.</p>
1519-
<p>The returned timestamps represent the number of seconds since
1520-
1970-01-01T00:00:00Z, also known as <a href="https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16">POSIX's Seconds Since the Epoch</a>,
1521-
also known as <a href="https://en.wikipedia.org/wiki/Unix_time">Unix Time</a>.</p>
1522-
<p>The nanoseconds field of the output is always less than 1000000000.</p>
1523-
<h5>Return values</h5>
1524-
<ul>
1525-
<li><a name="now.0"></a> <a href="#datetime"><a href="#datetime"><code>datetime</code></a></a></li>
1526-
</ul>
1527-
<h4><a name="resolution"></a><code>resolution: func</code></h4>
1528-
<p>Query the resolution of the clock.</p>
1529-
<p>The nanoseconds field of the output is always less than 1000000000.</p>
1530-
<h5>Return values</h5>
1531-
<ul>
1532-
<li><a name="resolution.0"></a> <a href="#datetime"><a href="#datetime"><code>datetime</code></a></a></li>
1533-
</ul>

0 commit comments

Comments
 (0)