From 15b5d549653d355ca565079c46bf76c28bdd60da Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 10:48:52 -0800
Subject: [PATCH 1/6] wasi-io dep: updated to 0.2.0
this is copied in manually, not using wit-deps, because wasi:io's change hasnt merged to main yet.
---
wit/deps/io/error.wit | 2 +-
wit/deps/io/poll.wit | 4 ++--
wit/deps/io/streams.wit | 23 +++++++++++++++++------
wit/deps/io/world.wit | 2 +-
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/wit/deps/io/error.wit b/wit/deps/io/error.wit
index 31918ac..22e5b64 100644
--- a/wit/deps/io/error.wit
+++ b/wit/deps/io/error.wit
@@ -1,4 +1,4 @@
-package wasi:io@0.2.0-rc-2023-11-10;
+package wasi:io@0.2.0;
interface error {
diff --git a/wit/deps/io/poll.wit b/wit/deps/io/poll.wit
index bddde3c..ddc67f8 100644
--- a/wit/deps/io/poll.wit
+++ b/wit/deps/io/poll.wit
@@ -1,9 +1,9 @@
-package wasi:io@0.2.0-rc-2023-11-10;
+package wasi:io@0.2.0;
/// A poll API intended to let users wait for I/O events on multiple handles
/// at once.
interface poll {
- /// `pollable` epresents a single I/O event which may be ready, or not.
+ /// `pollable` represents a single I/O event which may be ready, or not.
resource pollable {
/// Return the readiness of a pollable. This function never blocks.
diff --git a/wit/deps/io/streams.wit b/wit/deps/io/streams.wit
index e7e1b68..6d2f871 100644
--- a/wit/deps/io/streams.wit
+++ b/wit/deps/io/streams.wit
@@ -1,4 +1,4 @@
-package wasi:io@0.2.0-rc-2023-11-10;
+package wasi:io@0.2.0;
/// WASI I/O is an I/O abstraction API which is currently focused on providing
/// stream types.
@@ -32,6 +32,11 @@ interface streams {
resource input-stream {
/// Perform a non-blocking read from the stream.
///
+ /// When the source of a `read` is binary data, the bytes from the source
+ /// are returned verbatim. When the source of a `read` is known to the
+ /// implementation to be text, bytes containing the UTF-8 encoding of the
+ /// text are returned.
+ ///
/// This function returns a list of bytes containing the read data,
/// when successful. The returned list will contain up to `len` bytes;
/// it may return fewer than requested, but not more. The list is
@@ -111,6 +116,12 @@ interface streams {
/// Perform a write. This function never blocks.
///
+ /// When the destination of a `write` is binary data, the bytes from
+ /// `contents` are written verbatim. When the destination of a `write` is
+ /// known to the implementation to be text, the bytes of `contents` are
+ /// transcoded from UTF-8 into the encoding of the destination and then
+ /// written.
+ ///
/// Precondition: check-write gave permit of Ok(n) and contents has a
/// length of less than or equal to n. Otherwise, this function will trap.
///
@@ -131,7 +142,7 @@ interface streams {
/// let pollable = this.subscribe();
/// while !contents.is_empty() {
/// // Wait for the stream to become writable
- /// poll-one(pollable);
+ /// pollable.block();
/// let Ok(n) = this.check-write(); // eliding error handling
/// let len = min(n, contents.len());
/// let (chunk, rest) = contents.split_at(len);
@@ -140,7 +151,7 @@ interface streams {
/// }
/// this.flush();
/// // Wait for completion of `flush`
- /// poll-one(pollable);
+ /// pollable.block();
/// // Check for any errors that arose during `flush`
/// let _ = this.check-write(); // eliding error handling
/// ```
@@ -178,7 +189,7 @@ interface streams {
/// Write zeroes to a stream.
///
- /// this should be used precisely like `write` with the exact same
+ /// This should be used precisely like `write` with the exact same
/// preconditions (must use check-write first), but instead of
/// passing a list of bytes, you simply pass the number of zero-bytes
/// that should be written.
@@ -199,7 +210,7 @@ interface streams {
/// let pollable = this.subscribe();
/// while num_zeroes != 0 {
/// // Wait for the stream to become writable
- /// poll-one(pollable);
+ /// pollable.block();
/// let Ok(n) = this.check-write(); // eliding error handling
/// let len = min(n, num_zeroes);
/// this.write-zeroes(len); // eliding error handling
@@ -207,7 +218,7 @@ interface streams {
/// }
/// this.flush();
/// // Wait for completion of `flush`
- /// poll-one(pollable);
+ /// pollable.block();
/// // Check for any errors that arose during `flush`
/// let _ = this.check-write(); // eliding error handling
/// ```
diff --git a/wit/deps/io/world.wit b/wit/deps/io/world.wit
index 8243da2..5f0b43f 100644
--- a/wit/deps/io/world.wit
+++ b/wit/deps/io/world.wit
@@ -1,4 +1,4 @@
-package wasi:io@0.2.0-rc-2023-11-10;
+package wasi:io@0.2.0;
world imports {
import streams;
From 5573c65a5e7d135a94e79c9b44545067df18bd36 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 10:50:22 -0800
Subject: [PATCH 2/6] use wasi:io at 0.2.0
---
wit/monotonic-clock.wit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wit/monotonic-clock.wit b/wit/monotonic-clock.wit
index 09ef32c..975aa27 100644
--- a/wit/monotonic-clock.wit
+++ b/wit/monotonic-clock.wit
@@ -10,7 +10,7 @@ package wasi:clocks@0.2.0-rc-2023-11-10;
///
/// It is intended for measuring elapsed time.
interface monotonic-clock {
- use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
+ use wasi:io/poll@0.2.0.{pollable};
/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
From a1308f31824c8b052cdb74148f4b30ee322bfc57 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 10:50:37 -0800
Subject: [PATCH 3/6] set wasi:clocks package version to 0.2.0
---
wit/monotonic-clock.wit | 2 +-
wit/wall-clock.wit | 2 +-
wit/world.wit | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/wit/monotonic-clock.wit b/wit/monotonic-clock.wit
index 975aa27..4e4dc3a 100644
--- a/wit/monotonic-clock.wit
+++ b/wit/monotonic-clock.wit
@@ -1,4 +1,4 @@
-package wasi:clocks@0.2.0-rc-2023-11-10;
+package wasi:clocks@0.2.0;
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
diff --git a/wit/wall-clock.wit b/wit/wall-clock.wit
index 8abb9a0..440ca0f 100644
--- a/wit/wall-clock.wit
+++ b/wit/wall-clock.wit
@@ -1,4 +1,4 @@
-package wasi:clocks@0.2.0-rc-2023-11-10;
+package wasi:clocks@0.2.0;
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
diff --git a/wit/world.wit b/wit/world.wit
index 8fa080f..c022457 100644
--- a/wit/world.wit
+++ b/wit/world.wit
@@ -1,4 +1,4 @@
-package wasi:clocks@0.2.0-rc-2023-11-10;
+package wasi:clocks@0.2.0;
world imports {
import monotonic-clock;
From 78745c5bd3aaa0a985b0f2e5d072c73c16086dbc Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 10:50:51 -0800
Subject: [PATCH 4/6] generate markdown
---
imports.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/imports.md b/imports.md
index 54b0ed6..7857ce6 100644
--- a/imports.md
+++ b/imports.md
@@ -2,19 +2,19 @@
-
+
A poll API intended to let users wait for I/O events on multiple handles
at once.
Types
-
+pollable
represents a single I/O event which may be ready, or not.
Functions
Return the readiness of a pollable. This function never blocks.
@@ -58,7 +58,7 @@ being reaedy for I/O.
-
+
WASI Monotonic Clock is a clock API intended to let users measure elapsed
time.
It is intended to be portable at least between Unix-family platforms and
@@ -119,7 +119,7 @@ occured.
-
+
WASI Wall Clock is a clock API intended to let users query the current
time. The name "wall" makes an analogy to a "clock on the wall", which
is not necessarily monotonic as it may be reset.
From 581dd218b484bcfba276a93a39bc18147594168c Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Thu, 25 Jan 2024 10:55:45 -0800
Subject: [PATCH 5/6] wit-deps update: only changes to lockfile!
---
wit/deps.lock | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wit/deps.lock b/wit/deps.lock
index 48ee47f..a1d7a27 100644
--- a/wit/deps.lock
+++ b/wit/deps.lock
@@ -1,4 +1,4 @@
[io]
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
-sha256 = "f2e6127b235c37c06be675a904d6acf08db953ea688d78c42892c6ad3bd194e4"
-sha512 = "32feefbc115c34bf6968cb6e9dc15e755698ee90648e5a5d84448917c36a318bd61b401195eb64330e2475e1d098bfb8dee1440d594a68e0797748762bd84ae5"
+sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
+sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"
From 7bc4e28c1394f6cdc876f08f31228b3414193295 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Thu, 25 Jan 2024 10:59:03 -0800
Subject: [PATCH 6/6] CI: wit-abi-up-to-date@v17
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index af3c079..5ca5ba1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -18,4 +18,4 @@ jobs:
./wit-deps lock
git add -N wit/deps
git diff --exit-code
- - uses: WebAssembly/wit-abi-up-to-date@v16
+ - uses: WebAssembly/wit-abi-up-to-date@v17