Skip to content

Commit 10ccfe7

Browse files
authored
Merge pull request #36 from michelleN/wit-updates
update wit files to match new structure in Spin
2 parents 1f07acf + 359a01b commit 10ccfe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5428
-48
lines changed

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ members = [
6666
http-body-util = "0.1.0"
6767
hyper = "1.2.0"
6868
reqwest = "0.11.24"
69-
tokio = { version = "1.36.0", features = ["fs", "process", "macros", "rt-multi-thread", "sync"] }
69+
tokio = { version = "1.36.0", features = [
70+
"fs",
71+
"process",
72+
"macros",
73+
"rt-multi-thread",
74+
"sync",
75+
] }
7076
wasmtime = "18.0.1"
7177
wasmtime-wasi = "18.0.1"
7278
wasmtime-wasi-http = "18.0.1"
@@ -84,4 +90,4 @@ homepage = "https://developer.fermyon.com/spin/v2/rust-components"
8490
[workspace.dependencies]
8591
wit-bindgen = "0.16.0"
8692
futures = "0.3.28"
87-
once_cell = "1.18.0"
93+
once_cell = "1.18.0"

src/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use types::{
1212
};
1313

1414
use self::conversions::{TryFromIncomingResponse, TryIntoOutgoingRequest};
15-
use super::wit::wasi::http::types;
15+
use super::wit::wasi::http0_2_0::types;
1616
use futures::SinkExt;
1717
use spin_executor::bindings::wasi::io::streams::{self, StreamError};
1818

src/http/executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::wit::wasi::http::outgoing_handler;
2-
use crate::wit::wasi::http::types::{
1+
use crate::wit::wasi::http0_2_0::outgoing_handler;
2+
use crate::wit::wasi::http0_2_0::types::{
33
ErrorCode, IncomingBody, IncomingResponse, OutgoingBody, OutgoingRequest,
44
};
55

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package wasi:cli@0.2.0-rc-2023-10-18;
2+
3+
world command {
4+
include reactor;
5+
6+
export run;
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
interface environment {
2+
/// Get the POSIX-style environment variables.
3+
///
4+
/// Each environment variable is provided as a pair of string variable names
5+
/// and string value.
6+
///
7+
/// Morally, these are a value import, but until value imports are available
8+
/// in the component model, this import function should return the same
9+
/// values each time it is called.
10+
get-environment: func() -> list<tuple<string, string>>;
11+
12+
/// Get the POSIX-style arguments to the program.
13+
get-arguments: func() -> list<string>;
14+
15+
/// Return a path that programs should use as their initial current working
16+
/// directory, interpreting `.` as shorthand for this.
17+
initial-cwd: func() -> option<string>;
18+
}

wit/deps/cli-2023-10-18/exit.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface exit {
2+
/// Exit the current instance and any linked instances.
3+
exit: func(status: result);
4+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package wasi:cli@0.2.0-rc-2023-10-18;
2+
3+
world reactor {
4+
import wasi:clocks/wall-clock@0.2.0-rc-2023-10-18;
5+
import wasi:clocks/monotonic-clock@0.2.0-rc-2023-10-18;
6+
import wasi:clocks/timezone@0.2.0-rc-2023-10-18;
7+
import wasi:filesystem/types@0.2.0-rc-2023-10-18;
8+
import wasi:filesystem/preopens@0.2.0-rc-2023-10-18;
9+
import wasi:sockets/instance-network@0.2.0-rc-2023-10-18;
10+
import wasi:sockets/ip-name-lookup@0.2.0-rc-2023-10-18;
11+
import wasi:sockets/network@0.2.0-rc-2023-10-18;
12+
import wasi:sockets/tcp-create-socket@0.2.0-rc-2023-10-18;
13+
import wasi:sockets/tcp@0.2.0-rc-2023-10-18;
14+
import wasi:sockets/udp-create-socket@0.2.0-rc-2023-10-18;
15+
import wasi:sockets/udp@0.2.0-rc-2023-10-18;
16+
import wasi:random/random@0.2.0-rc-2023-10-18;
17+
import wasi:random/insecure@0.2.0-rc-2023-10-18;
18+
import wasi:random/insecure-seed@0.2.0-rc-2023-10-18;
19+
import wasi:io/poll@0.2.0-rc-2023-10-18;
20+
import wasi:io/streams@0.2.0-rc-2023-10-18;
21+
22+
import environment;
23+
import exit;
24+
import stdin;
25+
import stdout;
26+
import stderr;
27+
import terminal-input;
28+
import terminal-output;
29+
import terminal-stdin;
30+
import terminal-stdout;
31+
import terminal-stderr;
32+
}

wit/deps/cli-2023-10-18/run.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface run {
2+
/// Run the program.
3+
run: func() -> result;
4+
}

wit/deps/cli-2023-10-18/stdio.wit

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
interface stdin {
2+
use wasi:io/streams@0.2.0-rc-2023-10-18.{input-stream};
3+
4+
get-stdin: func() -> input-stream;
5+
}
6+
7+
interface stdout {
8+
use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
9+
10+
get-stdout: func() -> output-stream;
11+
}
12+
13+
interface stderr {
14+
use wasi:io/streams@0.2.0-rc-2023-10-18.{output-stream};
15+
16+
get-stderr: func() -> output-stream;
17+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
interface terminal-input {
2+
/// The input side of a terminal.
3+
resource terminal-input;
4+
5+
// In the future, this may include functions for disabling echoing,
6+
// disabling input buffering so that keyboard events are sent through
7+
// immediately, querying supported features, and so on.
8+
}
9+
10+
interface terminal-output {
11+
/// The output side of a terminal.
12+
resource terminal-output;
13+
14+
// In the future, this may include functions for querying the terminal
15+
// size, being notified of terminal size changes, querying supported
16+
// features, and so on.
17+
}
18+
19+
/// An interface providing an optional `terminal-input` for stdin as a
20+
/// link-time authority.
21+
interface terminal-stdin {
22+
use terminal-input.{terminal-input};
23+
24+
/// If stdin is connected to a terminal, return a `terminal-input` handle
25+
/// allowing further interaction with it.
26+
get-terminal-stdin: func() -> option<terminal-input>;
27+
}
28+
29+
/// An interface providing an optional `terminal-output` for stdout as a
30+
/// link-time authority.
31+
interface terminal-stdout {
32+
use terminal-output.{terminal-output};
33+
34+
/// If stdout is connected to a terminal, return a `terminal-output` handle
35+
/// allowing further interaction with it.
36+
get-terminal-stdout: func() -> option<terminal-output>;
37+
}
38+
39+
/// An interface providing an optional `terminal-output` for stderr as a
40+
/// link-time authority.
41+
interface terminal-stderr {
42+
use terminal-output.{terminal-output};
43+
44+
/// If stderr is connected to a terminal, return a `terminal-output` handle
45+
/// allowing further interaction with it.
46+
get-terminal-stderr: func() -> option<terminal-output>;
47+
}

0 commit comments

Comments
 (0)