From 23d42264290d494651cc91fcb31013cc71a1f34f Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 11:59:36 -0800
Subject: [PATCH 1/5] copy in io and clocks deps at 0.2.0
---
wit/deps/clocks/monotonic-clock.wit | 4 ++--
wit/deps/clocks/wall-clock.wit | 2 +-
wit/deps/clocks/world.wit | 2 +-
wit/deps/io/error.wit | 2 +-
wit/deps/io/poll.wit | 4 ++--
wit/deps/io/streams.wit | 23 +++++++++++++++++------
wit/deps/io/world.wit | 2 +-
7 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/wit/deps/clocks/monotonic-clock.wit b/wit/deps/clocks/monotonic-clock.wit
index 09ef32c..4e4dc3a 100644
--- a/wit/deps/clocks/monotonic-clock.wit
+++ b/wit/deps/clocks/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.
///
@@ -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
diff --git a/wit/deps/clocks/wall-clock.wit b/wit/deps/clocks/wall-clock.wit
index 8abb9a0..440ca0f 100644
--- a/wit/deps/clocks/wall-clock.wit
+++ b/wit/deps/clocks/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/deps/clocks/world.wit b/wit/deps/clocks/world.wit
index 8fa080f..c022457 100644
--- a/wit/deps/clocks/world.wit
+++ b/wit/deps/clocks/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;
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 e3e6f0de609bdc8f64b2ffc3dc1239ccac7f0d65 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 12:00:51 -0800
Subject: [PATCH 2/5] update uses of io and clocks to @0.2.0
---
wit/ip-name-lookup.wit | 2 +-
wit/tcp.wit | 6 +++---
wit/udp.wit | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/wit/ip-name-lookup.wit b/wit/ip-name-lookup.wit
index 931ccf7..8e639ec 100644
--- a/wit/ip-name-lookup.wit
+++ b/wit/ip-name-lookup.wit
@@ -1,6 +1,6 @@
interface ip-name-lookup {
- use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
+ use wasi:io/poll@0.2.0.{pollable};
use network.{network, error-code, ip-address};
diff --git a/wit/tcp.wit b/wit/tcp.wit
index 9f12b82..5902b9e 100644
--- a/wit/tcp.wit
+++ b/wit/tcp.wit
@@ -1,8 +1,8 @@
interface tcp {
- use wasi:io/streams@0.2.0-rc-2023-11-10.{input-stream, output-stream};
- use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
- use wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10.{duration};
+ use wasi:io/streams@0.2.0.{input-stream, output-stream};
+ use wasi:io/poll@0.2.0.{pollable};
+ use wasi:clocks/monotonic-clock@0.2.0.{duration};
use network.{network, error-code, ip-socket-address, ip-address-family};
enum shutdown-type {
diff --git a/wit/udp.wit b/wit/udp.wit
index 6ba380f..d987a0a 100644
--- a/wit/udp.wit
+++ b/wit/udp.wit
@@ -1,6 +1,6 @@
interface udp {
- use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
+ use wasi:io/poll@0.2.0.{pollable};
use network.{network, error-code, ip-socket-address, ip-address-family};
/// A received datagram.
From 5d44447ff0a30f68469fbd156bc9f05bc0440aea Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 12:01:10 -0800
Subject: [PATCH 3/5] set wasi:sockets package version to 0.2.0
---
wit/world.wit | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wit/world.wit b/wit/world.wit
index 8588cc6..f8bb92a 100644
--- a/wit/world.wit
+++ b/wit/world.wit
@@ -1,4 +1,4 @@
-package wasi:sockets@0.2.0-rc-2024-01-16;
+package wasi:sockets@0.2.0;
world imports {
import instance-network;
From 55360a538cad66a6865e4a3bb786b7ffe09ecbea Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Wed, 24 Jan 2024 12:01:28 -0800
Subject: [PATCH 4/5] update markdown
---
imports.md | 65 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 28 deletions(-)
diff --git a/imports.md b/imports.md
index 8f73f27..45ff953 100644
--- a/imports.md
+++ b/imports.md
@@ -2,21 +2,21 @@
-
+
Types
@@ -209,7 +209,7 @@ supported size.
ipv4
: ipv4-socket-address
ipv6
: ipv6-socket-address
-
+
This interface provides a value-export of the default network handle..
Types
@@ -224,13 +224,13 @@ supported size.
-
+
A poll API intended to let users wait for I/O events on multiple handles
at once.
Types
-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.
Functions
Return the readiness of a pollable. This function never blocks.
@@ -274,7 +274,7 @@ being reaedy for I/O.
-
+
Types
@@ -688,7 +688,7 @@ It's planned to be removed when future
is natively supported in Pre
-
+
Types
@@ -733,7 +733,7 @@ the socket is effectively an in-memory configuration object, unable to communica
-
+
Types
@@ -768,7 +768,7 @@ hazard.
-
+
WASI I/O is an I/O abstraction API which is currently focused on providing
stream types.
In the future, the component model is expected to add built-in stream types;
@@ -816,6 +816,10 @@ polled for using wasi:io/poll
.
Functions
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
@@ -911,6 +915,11 @@ error.
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.
returns Err(closed) without writing if the stream has closed since
@@ -933,7 +942,7 @@ following pseudo-code:
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);
@@ -942,7 +951,7 @@ while !contents.is_empty() {
}
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
@@ -1002,7 +1011,7 @@ all derived pollable
s created with this fun
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.
@@ -1025,7 +1034,7 @@ the following pseudo-code:
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
@@ -1033,7 +1042,7 @@ while num_zeroes != 0 {
}
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
@@ -1084,7 +1093,7 @@ is ready for reading, before performing the splice
.
-
+
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
@@ -1145,7 +1154,7 @@ occured.
-
+
Types
@@ -1736,7 +1745,7 @@ has no effect and returns ok
.
-
+
Types
@@ -1781,7 +1790,7 @@ is called, the socket is effectively an in-memory configuration object, unable t
-
+
Types
From 4f236c6aee13c019ce8f96025d4ed6600f021e01 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Thu, 25 Jan 2024 11:04:13 -0800
Subject: [PATCH 5/5] wit-deps update: just lockfile changes
---
wit/deps.lock | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/wit/deps.lock b/wit/deps.lock
index be53c76..64c71e7 100644
--- a/wit/deps.lock
+++ b/wit/deps.lock
@@ -1,9 +1,9 @@
[clocks]
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
-sha256 = "89da8eca4cd195516574c89c5b3c24a7b5af3ff2565c16753d20d3bdbc5fc60f"
-sha512 = "244079b3f592d58478a97adbd0bee8d49ae9dd1a3e435651ee40997b50da9fe62cfaba7e3ec7f7406d7d0288d278a43a3a0bc5150226ba40ce0f8ac6d33f7ddb"
+sha256 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
+sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"
[io]
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
-sha256 = "f2e6127b235c37c06be675a904d6acf08db953ea688d78c42892c6ad3bd194e4"
-sha512 = "32feefbc115c34bf6968cb6e9dc15e755698ee90648e5a5d84448917c36a318bd61b401195eb64330e2475e1d098bfb8dee1440d594a68e0797748762bd84ae5"
+sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
+sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"