Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to Resources, and other API cleanups. #46

Merged
merged 6 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,5 @@ jobs:
name: Check ABI files are up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ensure `./wit/deps` are in sync
run: |
curl -Lo 'wit-deps' https://github.com/bytecodealliance/wit-deps/releases/download/v0.3.2/wit-deps-x86_64-unknown-linux-musl
chmod +x wit-deps
./wit-deps lock --check
- uses: WebAssembly/wit-abi-up-to-date@v13
with:
wit-abi-tag: wit-abi-0.11.0
- uses: actions/checkout@v3
- uses: WebAssembly/wit-abi-up-to-date@v15
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ types, `input-stream`, and `output-stream`, which support `read` and

// If we didn't get any data promptly, wait for it.
if data.len() == 0 {
let _ = poll_oneoff(&wait_input[..]);
let _ = poll_list(&wait_input[..]);
(data, eos) = input.read(BUFFER_LEN)?;
}

Expand All @@ -79,7 +79,7 @@ types, `input-stream`, and `output-stream`, which support `read` and

// If we didn't put any data promptly, wait for it.
if num_written == 0 {
let _ = poll_oneoff(&wait_output[..]);
let _ = poll_list(&wait_output[..]);
num_written = output.write(remaining)?;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ types, `input-stream`, and `output-stream`, which support `read` and

// If we didn't get any data promptly, wait for it.
if num_copied == 0 {
let _ = poll_oneoff(&wait_input[..]);
let _ = poll_list(&wait_input[..]);
}
}
Ok(())
Expand Down
417 changes: 0 additions & 417 deletions example-world.md

This file was deleted.

386 changes: 386 additions & 0 deletions imports.md

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions wit/deps.lock

This file was deleted.

1 change: 0 additions & 1 deletion wit/deps.toml

This file was deleted.

49 changes: 0 additions & 49 deletions wit/deps/poll/poll.wit

This file was deleted.

5 changes: 0 additions & 5 deletions wit/deps/poll/world.wit

This file was deleted.

34 changes: 34 additions & 0 deletions wit/poll.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package wasi:io

/// A poll API intended to let users wait for I/O events on multiple handles
/// at once.
interface poll {
/// A "pollable" handle.
resource pollable

/// Poll for completion on a set of pollables.
///
/// This function takes a list of pollables, which identify I/O sources of
/// interest, and waits until one or more of the events is ready for I/O.
///
/// The result `list<u32>` contains one or more indices of handles in the
/// argument list that is ready for I/O.
///
/// If the list contains more elements than can be indexed with a `u32`
/// value, this function traps.
///
/// A timeout can be implemented by adding a pollable from the
/// wasi-clocks API to the list.
///
/// This function does not return a `result`; polling in itself does not
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
/// the pollables has an error, it is indicated by marking the source as
/// being reaedy for I/O.
poll-list: func(in: list<borrow<pollable>>) -> list<u32>

/// Poll for completion on a single pollable.
///
/// This function is similar to `poll-list`, but operates on only a single
/// pollable. When it returns, the handle is ready for I/O.
poll-one: func(in: borrow<pollable>)
}
Loading