Skip to content
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
2 changes: 1 addition & 1 deletion crates/world/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ wasmtime::component::bindgen!({
include fermyon:spin/platform@3.0.0;
include spin:up/platform@3.2.0;
include spin:up/platform@3.4.0;
include spin:up/platform@4.0.0;
include spin:up/platform@4.3.0;
include wasi:keyvalue/imports@0.2.0-draft2;
export spin:redis/inbound-redis@3.0.0;
}
Expand Down
10 changes: 10 additions & 0 deletions wit/deps/cli@0.3.2/command.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package wasi:cli@0.3.2;

@since(version = 0.3.0)
world command {
@since(version = 0.3.0)
include imports;

@since(version = 0.3.0)
export run;
}
22 changes: 22 additions & 0 deletions wit/deps/cli@0.3.2/environment.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@since(version = 0.3.0)
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.
@since(version = 0.3.0)
get-environment: func() -> list<tuple<string, string>>;

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

/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
@since(version = 0.3.0)
get-initial-cwd: func() -> option<string>;
}
17 changes: 17 additions & 0 deletions wit/deps/cli@0.3.2/exit.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@since(version = 0.3.0)
interface exit {
/// Exit the current instance and any linked instances.
@since(version = 0.3.0)
exit: func(status: result);

/// Exit the current instance and any linked instances, reporting the
/// specified status code to the host.
///
/// The meaning of the code depends on the context, with 0 usually meaning
/// "success", and other values indicating various types of failure.
///
/// This function does not return; the effect is analogous to a trap, but
/// without the connotation that something bad has happened.
@since(version = 0.3.0)
exit-with-code: func(status-code: u8);
}
34 changes: 34 additions & 0 deletions wit/deps/cli@0.3.2/imports.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package wasi:cli@0.3.2;

@since(version = 0.3.0)
world imports {
@since(version = 0.3.0)
include wasi:clocks/imports@0.3.2;
@since(version = 0.3.0)
include wasi:filesystem/imports@0.3.2;
@since(version = 0.3.0)
include wasi:sockets/imports@0.3.2;
@since(version = 0.3.0)
include wasi:random/imports@0.3.2;

@since(version = 0.3.0)
import environment;
@since(version = 0.3.0)
import exit;
@since(version = 0.3.0)
import stdin;
@since(version = 0.3.0)
import stdout;
@since(version = 0.3.0)
import stderr;
@since(version = 0.3.0)
import terminal-input;
@since(version = 0.3.0)
import terminal-output;
@since(version = 0.3.0)
import terminal-stdin;
@since(version = 0.3.0)
import terminal-stdout;
@since(version = 0.3.0)
import terminal-stderr;
}
6 changes: 6 additions & 0 deletions wit/deps/cli@0.3.2/run.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@since(version = 0.3.0)
interface run {
/// Run the program.
@since(version = 0.3.0)
run: async func() -> result;
}
65 changes: 65 additions & 0 deletions wit/deps/cli@0.3.2/stdio.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@since(version = 0.3.0)
interface types {
@since(version = 0.3.0)
enum error-code {
/// Input/output error
io,
/// Invalid or incomplete multibyte or wide character
illegal-byte-sequence,
/// Broken pipe
pipe,
}
}

@since(version = 0.3.0)
interface stdin {
use types.{error-code};

/// Return a stream for reading from stdin.
///
/// This function returns a stream which provides data read from stdin,
/// and a future to signal read results.
///
/// If the stream's readable end is dropped the future will resolve to success.
///
/// If the stream's writable end is dropped the future will either resolve to
/// success if stdin was closed by the writer or to an error-code if reading
/// failed for some other reason.
///
/// Multiple streams may be active at the same time. The behavior of concurrent
/// reads is implementation-specific.
@since(version = 0.3.0)
read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
}

@since(version = 0.3.0)
interface stdout {
use types.{error-code};

/// Write the given stream to stdout.
///
/// If the stream's writable end is dropped this function will either return
/// success once the entire contents of the stream have been written or an
/// error-code representing a failure.
///
/// Otherwise if there is an error the readable end of the stream will be
/// dropped and this function will return an error-code.
@since(version = 0.3.0)
write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
}

@since(version = 0.3.0)
interface stderr {
use types.{error-code};

/// Write the given stream to stderr.
///
/// If the stream's writable end is dropped this function will either return
/// success once the entire contents of the stream have been written or an
/// error-code representing a failure.
///
/// Otherwise if there is an error the readable end of the stream will be
/// dropped and this function will return an error-code.
@since(version = 0.3.0)
write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
}
62 changes: 62 additions & 0 deletions wit/deps/cli@0.3.2/terminal.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/// 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.
@since(version = 0.3.0)
interface terminal-input {
/// The input side of a terminal.
@since(version = 0.3.0)
resource terminal-input;
}

/// 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.
@since(version = 0.3.0)
interface terminal-output {
/// The output side of a terminal.
@since(version = 0.3.0)
resource terminal-output;
}

/// An interface providing an optional `terminal-input` for stdin as a
/// link-time authority.
@since(version = 0.3.0)
interface terminal-stdin {
@since(version = 0.3.0)
use terminal-input.{terminal-input};

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

/// An interface providing an optional `terminal-output` for stdout as a
/// link-time authority.
@since(version = 0.3.0)
interface terminal-stdout {
@since(version = 0.3.0)
use terminal-output.{terminal-output};

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

/// An interface providing an optional `terminal-output` for stderr as a
/// link-time authority.
@since(version = 0.3.0)
interface terminal-stderr {
@since(version = 0.3.0)
use terminal-output.{terminal-output};

/// If stderr is connected to a terminal, return a `terminal-output` handle
/// allowing further interaction with it.
@since(version = 0.3.0)
get-terminal-stderr: func() -> option<terminal-output>;
}
48 changes: 48 additions & 0 deletions wit/deps/clocks@0.3.2/monotonic-clock.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package wasi:clocks@0.3.2;
/// 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.
@since(version = 0.3.0)
interface monotonic-clock {
use types.{duration};

/// A mark on a monotonic clock is a number of nanoseconds since an
/// unspecified initial value, and can only be compared to instances from
/// the same monotonic-clock.
@since(version = 0.3.0)
type mark = 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.
///
/// For completeness, this function traps if it's not possible to represent
/// the value of the clock in a `mark`. Consequently, implementations
/// should ensure that the starting time is low enough to avoid the
/// possibility of overflow in practice.
@since(version = 0.3.0)
now: func() -> mark;

/// Query the resolution of the clock. Returns the duration of time
/// corresponding to a clock tick.
@since(version = 0.3.0)
get-resolution: func() -> duration;

/// Wait until the specified mark has occurred.
@since(version = 0.3.0)
wait-until: async func(
when: mark,
);

/// Wait for the specified duration to elapse.
@since(version = 0.3.0)
wait-for: async func(
how-long: duration,
);
}
51 changes: 51 additions & 0 deletions wit/deps/clocks@0.3.2/system-clock.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package wasi:clocks@0.3.2;
/// WASI System Clock is a clock API intended to let users query the current
/// time. The clock is not necessarily monotonic as it may be reset.
///
/// It is intended to be portable at least between Unix-family platforms and
/// Windows.
///
/// External references may be reset, so this clock is not necessarily
/// monotonic, making it unsuitable for measuring elapsed time.
///
/// It is intended for reporting the current date and time for humans.
@since(version = 0.3.0)
interface system-clock {
use types.{duration};

/// An "instant", or "exact time", is a point in time without regard to any
/// time zone: just the time since a particular external reference point,
/// often called an "epoch".
///
/// Here, the epoch is 1970-01-01T00:00:00Z, also known as
/// [POSIX's Seconds Since the Epoch], also known as [Unix Time].
///
/// Note that even if the seconds field is negative, incrementing
/// nanoseconds always represents moving forwards in time.
/// For example, `{ -1 seconds, 999999999 nanoseconds }` represents the
/// instant one nanosecond before the epoch.
/// For more on various different ways to represent time, see
/// https://tc39.es/proposal-temporal/docs/timezone.html
///
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
@since(version = 0.3.0)
record instant {
seconds: s64,
nanoseconds: u32,
}

/// Read the current value of the clock.
///
/// This clock is not monotonic, therefore calling this function repeatedly
/// will not necessarily produce a sequence of non-decreasing values.
///
/// The nanoseconds field of the output is always less than 1000000000.
@since(version = 0.3.0)
now: func() -> instant;

/// Query the resolution of the clock. Returns the smallest duration of time
/// that the implementation permits distinguishing.
@since(version = 0.3.0)
get-resolution: func() -> duration;
}
46 changes: 46 additions & 0 deletions wit/deps/clocks@0.3.2/timezone.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package wasi:clocks@0.3.2;

@unstable(feature = clocks-timezone)
interface timezone {
@unstable(feature = clocks-timezone)
use system-clock.{instant};

/// Return the IANA identifier of the currently configured timezone. This
/// should be an identifier from the IANA Time Zone Database.
///
/// For displaying to a user, the identifier should be converted into a
/// localized name by means of an internationalization API.
///
/// If the implementation does not expose an actual timezone, or is unable
/// to provide mappings from times to deltas between the configured timezone
/// and UTC, or determining the current timezone fails, or the timezone does
/// not have an IANA identifier, this returns nothing.
@unstable(feature = clocks-timezone)
iana-id: func() -> option<string>;

/// The number of nanoseconds difference between UTC time and the local
/// time of the currently configured timezone, at the exact time of
/// `instant`.
///
/// The magnitude of the returned value will always be less than
/// 86,400,000,000,000 which is the number of nanoseconds in a day
/// (24*60*60*1e9).
///
/// If the implementation does not expose an actual timezone, or is unable
/// to provide mappings from times to deltas between the configured timezone
/// and UTC, or determining the current timezone fails, this returns
/// nothing.
@unstable(feature = clocks-timezone)
utc-offset: func(when: instant) -> option<s64>;

/// Returns a string that is suitable to assist humans in debugging whether
/// any timezone is available, and if so, which. This may be the same string
/// as `iana-id`, or a formatted representation of the UTC offset such as
/// `-04:00`, or something else.
///
/// WARNING: The returned string should not be consumed mechanically! It may
/// change across platforms, hosts, or other implementation details. Parsing
/// this string is a major platform-compatibility hazard.
@unstable(feature = clocks-timezone)
to-debug-string: func() -> string;
}
8 changes: 8 additions & 0 deletions wit/deps/clocks@0.3.2/types.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package wasi:clocks@0.3.2;
/// This interface common types used throughout wasi:clocks.
@since(version = 0.3.0)
interface types {
/// A duration of time, in nanoseconds.
@since(version = 0.3.0)
type duration = u64;
}
Loading
Loading