Skip to content

Commit

Permalink
update wit files to match new structure
Browse files Browse the repository at this point in the history
Signed-off-by: Michelle Dhanani <michelle@fermyon.com>
  • Loading branch information
michelleN committed Oct 30, 2024
1 parent 1f07acf commit 359a01b
Show file tree
Hide file tree
Showing 82 changed files with 5,428 additions and 48 deletions.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ members = [
http-body-util = "0.1.0"
hyper = "1.2.0"
reqwest = "0.11.24"
tokio = { version = "1.36.0", features = ["fs", "process", "macros", "rt-multi-thread", "sync"] }
tokio = { version = "1.36.0", features = [
"fs",
"process",
"macros",
"rt-multi-thread",
"sync",
] }
wasmtime = "18.0.1"
wasmtime-wasi = "18.0.1"
wasmtime-wasi-http = "18.0.1"
Expand All @@ -84,4 +90,4 @@ homepage = "https://developer.fermyon.com/spin/v2/rust-components"
[workspace.dependencies]
wit-bindgen = "0.16.0"
futures = "0.3.28"
once_cell = "1.18.0"
once_cell = "1.18.0"
2 changes: 1 addition & 1 deletion src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use types::{
};

use self::conversions::{TryFromIncomingResponse, TryIntoOutgoingRequest};
use super::wit::wasi::http::types;
use super::wit::wasi::http0_2_0::types;
use futures::SinkExt;
use spin_executor::bindings::wasi::io::streams::{self, StreamError};

Expand Down
4 changes: 2 additions & 2 deletions src/http/executor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::wit::wasi::http::outgoing_handler;
use crate::wit::wasi::http::types::{
use crate::wit::wasi::http0_2_0::outgoing_handler;
use crate::wit::wasi::http0_2_0::types::{
ErrorCode, IncomingBody, IncomingResponse, OutgoingBody, OutgoingRequest,
};

Expand Down
7 changes: 7 additions & 0 deletions wit/deps/cli-2023-10-18/command.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package wasi:cli@0.2.0-rc-2023-10-18;

world command {
include reactor;

export run;
}
18 changes: 18 additions & 0 deletions wit/deps/cli-2023-10-18/environment.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
interface environment {
/// Get the POSIX-style environment variables.
///
/// Each environment variable is provided as a pair of string variable names
/// and string value.
///
/// Morally, these are a value import, but until value imports are available
/// in the component model, this import function should return the same
/// values each time it is called.
get-environment: func() -> list<tuple<string, string>>;

/// Get the POSIX-style arguments to the program.
get-arguments: func() -> list<string>;

/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
initial-cwd: func() -> option<string>;
}
4 changes: 4 additions & 0 deletions wit/deps/cli-2023-10-18/exit.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface exit {
/// Exit the current instance and any linked instances.
exit: func(status: result);
}
32 changes: 32 additions & 0 deletions wit/deps/cli-2023-10-18/reactor.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package wasi:cli@0.2.0-rc-2023-10-18;

world reactor {
import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
import wasi:filesystem/types@0.2.0-rc-2023-10-18;
import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
import wasi:sockets/network@0.2.0-rc-2023-10-18;
import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
import wasi:sockets/udp@0.2.0-rc-2023-10-18;
import wasi:random/random@0.2.0-rc-2023-10-18;
import wasi:random/insecure@0.2.0-rc-2023-10-18;
import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
import wasi:io/poll@0.2.0-rc-2023-10-18;
import wasi:io/streams@0.2.0-rc-2023-10-18;

import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}
4 changes: 4 additions & 0 deletions wit/deps/cli-2023-10-18/run.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface run {
/// Run the program.
run: func() -> result;
}
17 changes: 17 additions & 0 deletions wit/deps/cli-2023-10-18/stdio.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
interface stdin {
use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream};

get-stdin: func() -> input-stream;
}

interface stdout {
use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};

get-stdout: func() -> output-stream;
}

interface stderr {
use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};

get-stderr: func() -> output-stream;
}
47 changes: 47 additions & 0 deletions wit/deps/cli-2023-10-18/terminal.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interface terminal-input {
/// The input side of a terminal.
resource terminal-input;

// In the future, this may include functions for disabling echoing,
// disabling input buffering so that keyboard events are sent through
// immediately, querying supported features, and so on.
}

interface terminal-output {
/// The output side of a terminal.
resource terminal-output;

// In the future, this may include functions for querying the terminal
// size, being notified of terminal size changes, querying supported
// features, and so on.
}

/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
interface terminal-stdin {
use terminal-input.{terminal-input};

/// If stdin is connected to a terminal, return a `terminal-input` handle
/// allowing further interaction with it.
get-terminal-stdin: func() -> option<terminal-input>;
}

/// An interface providing an optional `terminal-output` for stdout as a
/// link-time authority.
interface terminal-stdout {
use terminal-output.{terminal-output};

/// If stdout is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stdout: func() -> option<terminal-output>;
}

/// An interface providing an optional `terminal-output` for stderr as a
/// link-time authority.
interface terminal-stderr {
use terminal-output.{terminal-output};

/// If stderr is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stderr: func() -> option<terminal-output>;
}
7 changes: 7 additions & 0 deletions wit/deps/cli-2023-11-10/command.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package wasi:cli@0.2.0-rc-2023-11-10;

world command {
include reactor;

export run;
}
18 changes: 18 additions & 0 deletions wit/deps/cli-2023-11-10/environment.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
interface environment {
/// Get the POSIX-style environment variables.
///
/// Each environment variable is provided as a pair of string variable names
/// and string value.
///
/// Morally, these are a value import, but until value imports are available
/// in the component model, this import function should return the same
/// values each time it is called.
get-environment: func() -> list<tuple<string, string>>;

/// Get the POSIX-style arguments to the program.
get-arguments: func() -> list<string>;

/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
initial-cwd: func() -> option<string>;
}
4 changes: 4 additions & 0 deletions wit/deps/cli-2023-11-10/exit.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface exit {
/// Exit the current instance and any linked instances.
exit: func(status: result);
}
31 changes: 31 additions & 0 deletions wit/deps/cli-2023-11-10/reactor.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package wasi:cli@0.2.0-rc-2023-11-10;

world reactor {
import wasi:clocks/wall-clock@0.2.0-rc-2023-11-10;
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10;
import wasi:filesystem/types@0.2.0-rc-2023-11-10;
import wasi:filesystem/preopens@0.2.0-rc-2023-11-10;
import wasi:sockets/instance-network@0.2.0-rc-2023-11-10;
import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10;
import wasi:sockets/network@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/tcp@0.2.0-rc-2023-11-10;
import wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10;
import wasi:sockets/udp@0.2.0-rc-2023-11-10;
import wasi:random/random@0.2.0-rc-2023-11-10;
import wasi:random/insecure@0.2.0-rc-2023-11-10;
import wasi:random/insecure-seed@0.2.0-rc-2023-11-10;
import wasi:io/poll@0.2.0-rc-2023-11-10;
import wasi:io/streams@0.2.0-rc-2023-11-10;

import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}
4 changes: 4 additions & 0 deletions wit/deps/cli-2023-11-10/run.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface run {
/// Run the program.
run: func() -> result;
}
17 changes: 17 additions & 0 deletions wit/deps/cli-2023-11-10/stdio.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
interface stdin {
use wasi:io/streams@0.2.0-rc-2023-11-10.{input-stream};

get-stdin: func() -> input-stream;
}

interface stdout {
use wasi:io/streams@0.2.0-rc-2023-11-10.{output-stream};

get-stdout: func() -> output-stream;
}

interface stderr {
use wasi:io/streams@0.2.0-rc-2023-11-10.{output-stream};

get-stderr: func() -> output-stream;
}
47 changes: 47 additions & 0 deletions wit/deps/cli-2023-11-10/terminal.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interface terminal-input {
/// The input side of a terminal.
resource terminal-input;

// In the future, this may include functions for disabling echoing,
// disabling input buffering so that keyboard events are sent through
// immediately, querying supported features, and so on.
}

interface terminal-output {
/// The output side of a terminal.
resource terminal-output;

// In the future, this may include functions for querying the terminal
// size, being notified of terminal size changes, querying supported
// features, and so on.
}

/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
interface terminal-stdin {
use terminal-input.{terminal-input};

/// If stdin is connected to a terminal, return a `terminal-input` handle
/// allowing further interaction with it.
get-terminal-stdin: func() -> option<terminal-input>;
}

/// An interface providing an optional `terminal-output` for stdout as a
/// link-time authority.
interface terminal-stdout {
use terminal-output.{terminal-output};

/// If stdout is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stdout: func() -> option<terminal-output>;
}

/// An interface providing an optional `terminal-output` for stderr as a
/// link-time authority.
interface terminal-stderr {
use terminal-output.{terminal-output};

/// If stderr is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
get-terminal-stderr: func() -> option<terminal-output>;
}
32 changes: 32 additions & 0 deletions wit/deps/clocks-2023-10-18/monotonic-clock.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// 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
/// Windows.
///
/// A monotonic clock is a clock which has an unspecified initial value, and
/// successive reads of the clock will produce non-decreasing values.
///
/// It is intended for measuring elapsed time.
interface monotonic-clock {
use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};

/// A timestamp in nanoseconds.
type instant = u64;

/// Read the current value of the clock.
///
/// The clock is monotonic, therefore calling this function repeatedly will
/// produce a sequence of non-decreasing values.
now: func() -> instant;

/// Query the resolution of the clock.
resolution: func() -> instant;

/// Create a `pollable` which will resolve once the specified time has been
/// reached.
subscribe: func(
when: instant,
absolute: bool
) -> pollable;
}
48 changes: 48 additions & 0 deletions wit/deps/clocks-2023-10-18/timezone.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
interface timezone {
use wall-clock.{datetime};

/// Return information needed to display the given `datetime`. This includes
/// the UTC offset, the time zone name, and a flag indicating whether
/// daylight saving time is active.
///
/// If the timezone cannot be determined for the given `datetime`, return a
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
/// saving time.
display: func(when: datetime) -> timezone-display;

/// The same as `display`, but only return the UTC offset.
utc-offset: func(when: datetime) -> s32;

/// Information useful for displaying the timezone of a specific `datetime`.
///
/// This information may vary within a single `timezone` to reflect daylight
/// saving time adjustments.
record timezone-display {
/// The number of seconds difference between UTC time and the local
/// time of the timezone.
///
/// The returned value will always be less than 86400 which is the
/// number of seconds in a day (24*60*60).
///
/// In implementations that do not expose an actual time zone, this
/// should return 0.
utc-offset: s32,

/// The abbreviated name of the timezone to display to a user. The name
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
/// reference local standards for the name of the time zone.
///
/// In implementations that do not expose an actual time zone, this
/// should be the string `UTC`.
///
/// In time zones that do not have an applicable name, a formatted
/// representation of the UTC offset may be returned, such as `-04:00`.
name: string,

/// Whether daylight saving time is active.
///
/// In implementations that do not expose an actual time zone, this
/// should return false.
in-daylight-saving-time: bool,
}
}
Loading

0 comments on commit 359a01b

Please sign in to comment.