Skip to content

Commit 06cd9c3

Browse files
committed
Convert to resources.
Convert `descriptor` and `directory-entry-stream` to resources, and update the dependencies to account for the changes in WebAssembly/wasi-io#46 and WebAssembly/wasi-clocks#50.
1 parent 9675a4b commit 06cd9c3

File tree

11 files changed

+2334
-2206
lines changed

11 files changed

+2334
-2206
lines changed

example-world.md

Lines changed: 0 additions & 1439 deletions
Large diffs are not rendered by default.

imports.md

Lines changed: 1530 additions & 0 deletions
Large diffs are not rendered by default.

wit/deps.lock

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
[clocks]
2-
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
3-
sha256 = "1ed7e35b3f9738663854f0dd92a95bfadc410ea07170501f5c2fec0cc24e3d57"
4-
sha512 = "ef1e23704a8a8436fd3718593d4c4d8b6d1c64dad3595b7496c0888ca14b725046f2900109800faca1bc8c14f237cdcaca791dba8284e1ad50105ab2d036825b"
2+
url = "https://github.com/sunfishcode/wasi-clocks/archive/resources.tar.gz"
3+
sha256 = "ea955af7a152f85941b651c5b07345c4f077ae7f9e996c909ab8cc0a68c0120e"
4+
sha512 = "114bc4f583a487cf1ccfdd6efa25c4c60cf637d4501a189eebd4b1d52aec2c8eb63ae14ce494db53dfd25bc20f6c4b533dc6f2143537e5cd14ca80d5d4b6a49d"
55

66
[io]
7-
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
8-
sha256 = "a47690f7d4dba1683a42897cc65fe813409827d72cc93afe03b127ee81763e13"
9-
sha512 = "661aa9cf9c67d7d712caccfbb3c317da01b033764892623c8902d9dcfdb67f3088889102b036d3ed19d818a5c2d151247b25d9f6fd145cdf433f325605a5a747"
10-
11-
[poll]
12-
url = "https://github.com/WebAssembly/wasi-poll/archive/main.tar.gz"
13-
sha256 = "d4c27124f4c137eb538b5c92ba5858ed9042e11b24a2eef85d14becd0b7f55de"
14-
sha512 = "422c01b273b4b1377ece6f2e4ba0dfc609ca8ef30a3e0be0e172e1303fcf7b3ca4c470f4dea6c51bdf114b0f5c871ebc4934dfe3bf217d66ea689748df2b1e55"
7+
url = "https://github.com/sunfishcode/wasi-io/archive/resources.tar.gz"
8+
sha256 = "c01495e96837dbd33b8d8dd70b75a0bf2ee5795b6c85ab50701e870bbcf2ceb3"
9+
sha512 = "fd8f60fad6560396d07d530efb76a4c54ce823d523528ba5ba61ccdc521e361c1e9660d0a77c02a5e6b80ea981cddedbaa703322f1ba502333784ea974edb835"

wit/deps.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
io = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
2-
poll = "https://github.com/WebAssembly/wasi-poll/archive/main.tar.gz"
3-
clocks = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
1+
# Temporarily use the resources branches.
2+
#io = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
3+
io = "https://github.com/sunfishcode/wasi-io/archive/resources.tar.gz"
4+
#clocks = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
5+
clocks = "https://github.com/sunfishcode/wasi-clocks/archive/resources.tar.gz"

wit/deps/clocks/monotonic-clock.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
///
1010
/// It is intended for measuring elapsed time.
1111
interface monotonic-clock {
12-
use wasi:poll/poll.{pollable}
12+
use wasi:io/poll.{pollable}
1313

1414
/// A timestamp in nanoseconds.
1515
type instant = u64

wit/deps/clocks/timezone.wit

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
interface timezone {
22
use wall-clock.{datetime}
33

4-
/// A timezone.
5-
///
6-
/// In timezones that recognize daylight saving time, also known as daylight
7-
/// time and summer time, the information returned from the functions varies
8-
/// over time to reflect these adjustments.
9-
///
10-
/// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
11-
type timezone = u32
12-
134
/// Return information needed to display the given `datetime`. This includes
145
/// the UTC offset, the time zone name, and a flag indicating whether
156
/// daylight saving time is active.
167
///
178
/// If the timezone cannot be determined for the given `datetime`, return a
189
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
1910
/// saving time.
20-
display: func(this: timezone, when: datetime) -> timezone-display
11+
display: func(when: datetime) -> timezone-display
2112

2213
/// The same as `display`, but only return the UTC offset.
23-
utc-offset: func(this: timezone, when: datetime) -> s32
24-
25-
/// Dispose of the specified input-stream, after which it may no longer
26-
/// be used.
27-
drop-timezone: func(this: timezone)
14+
utc-offset: func(when: datetime) -> s32
2815

2916
/// Information useful for displaying the timezone of a specific `datetime`.
3017
///

wit/deps/clocks/world.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package wasi:clocks
22

3-
world example-world {
3+
world imports {
44
import monotonic-clock
55
import wall-clock
66
import timezone

wit/deps/io/poll.wit

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package wasi:io
2+
3+
/// A poll API intended to let users wait for I/O events on multiple handles
4+
/// at once.
5+
interface poll {
6+
/// A "pollable" handle.
7+
resource pollable
8+
9+
/// Poll for completion on a set of pollables.
10+
///
11+
/// This function takes a list of pollables, which identify I/O sources of
12+
/// interest, and waits until one or more of the events is ready for I/O.
13+
///
14+
/// The result `list<u32>` contains one or more indices of handles in the
15+
/// argument list that is ready for I/O.
16+
///
17+
/// If the list contains more elements than can be indexed with a `u32`
18+
/// value, this function traps.
19+
///
20+
/// A timeout can be implemented by adding a pollable from the
21+
/// wasi-clocks API to the list.
22+
///
23+
/// This function does not return a `result`; polling in itself does not
24+
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
25+
/// the pollables has an error, it is indicated by marking the source as
26+
/// being reaedy for I/O.
27+
poll-list: func(in: list<pollable>) -> list<u32>
28+
29+
/// Poll for completion on a single pollable.
30+
///
31+
/// This function is similar to `poll-list`, but operates on only a single
32+
/// pollable. When it returns, the handle is ready for I/O.
33+
poll-one: func(in: pollable)
34+
}

0 commit comments

Comments
 (0)