Skip to content

Commit 7d6a212

Browse files
committed
ci: include version in WIT deps
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent b513b1e commit 7d6a212

File tree

115 files changed

+3557
-2
lines changed

Some content is hidden

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

115 files changed

+3557
-2
lines changed

ci/vendor-wit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ make_vendor() {
2020

2121
for package in $packages; do
2222
IFS='@' read -r repo tag <<< "$package"
23-
mkdir -p $path/$repo
23+
mkdir -p $path/$package
2424
cached_extracted_dir="$cache_dir/$repo-$tag"
2525

2626
if [[ ! -d $cached_extracted_dir ]]; then
@@ -30,7 +30,7 @@ make_vendor() {
3030
rm -rf $cached_extracted_dir/wit/deps*
3131
fi
3232

33-
cp -r $cached_extracted_dir/wit/* $path/$repo
33+
cp -r $cached_extracted_dir/wit/* $path/$package
3434
done
3535
}
3636

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
interface store {
2+
/// An error type that encapsulates the different errors that can occur fetching configuration values.
3+
variant error {
4+
/// This indicates an error from an "upstream" config source.
5+
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc),
6+
/// the error message is a string.
7+
upstream(string),
8+
/// This indicates an error from an I/O operation.
9+
/// As this could be almost _anything_ (such as a file read, network connection, etc),
10+
/// the error message is a string.
11+
/// Depending on how this ends up being consumed,
12+
/// we may consider moving this to use the `wasi:io/error` type instead.
13+
/// For simplicity right now in supporting multiple implementations, it is being left as a string.
14+
io(string),
15+
}
16+
17+
/// Gets a configuration value of type `string` associated with the `key`.
18+
///
19+
/// The value is returned as an `option<string>`. If the key is not found,
20+
/// `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned.
21+
get: func(
22+
/// A string key to fetch
23+
key: string
24+
) -> result<option<string>, error>;
25+
26+
/// Gets a list of configuration key-value pairs of type `string`.
27+
///
28+
/// If an error occurs, an `Err(error)` is returned.
29+
get-all: func() -> result<list<tuple<string, string>>, error>;
30+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package wasi:config@0.2.0-draft;
2+
3+
world imports {
4+
/// The interface for wasi:config/store
5+
import store;
6+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/// This interface defines a handler of incoming HTTP Requests. It should
2+
/// be exported by components which can respond to HTTP Requests.
3+
@since(version = 0.2.0)
4+
interface incoming-handler {
5+
@since(version = 0.2.0)
6+
use types.{incoming-request, response-outparam};
7+
8+
/// This function is invoked with an incoming HTTP Request, and a resource
9+
/// `response-outparam` which provides the capability to reply with an HTTP
10+
/// Response. The response is sent by calling the `response-outparam.set`
11+
/// method, which allows execution to continue after the response has been
12+
/// sent. This enables both streaming to the response body, and performing other
13+
/// work.
14+
///
15+
/// The implementor of this function must write a response to the
16+
/// `response-outparam` before returning, or else the caller will respond
17+
/// with an error on its behalf.
18+
@since(version = 0.2.0)
19+
handle: func(
20+
request: incoming-request,
21+
response-out: response-outparam
22+
);
23+
}
24+
25+
/// This interface defines a handler of outgoing HTTP Requests. It should be
26+
/// imported by components which wish to make HTTP Requests.
27+
@since(version = 0.2.0)
28+
interface outgoing-handler {
29+
@since(version = 0.2.0)
30+
use types.{
31+
outgoing-request, request-options, future-incoming-response, error-code
32+
};
33+
34+
/// This function is invoked with an outgoing HTTP Request, and it returns
35+
/// a resource `future-incoming-response` which represents an HTTP Response
36+
/// which may arrive in the future.
37+
///
38+
/// The `options` argument accepts optional parameters for the HTTP
39+
/// protocol's transport layer.
40+
///
41+
/// This function may return an error if the `outgoing-request` is invalid
42+
/// or not allowed to be made. Otherwise, protocol errors are reported
43+
/// through the `future-incoming-response`.
44+
@since(version = 0.2.0)
45+
handle: func(
46+
request: outgoing-request,
47+
options: option<request-options>
48+
) -> result<future-incoming-response, error-code>;
49+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package wasi:http@0.2.3;
2+
3+
/// The `wasi:http/imports` world imports all the APIs for HTTP proxies.
4+
/// It is intended to be `include`d in other worlds.
5+
@since(version = 0.2.0)
6+
world imports {
7+
/// HTTP proxies have access to time and randomness.
8+
@since(version = 0.2.0)
9+
import wasi:clocks/monotonic-clock@0.2.3;
10+
@since(version = 0.2.0)
11+
import wasi:clocks/wall-clock@0.2.3;
12+
@since(version = 0.2.0)
13+
import wasi:random/random@0.2.3;
14+
15+
/// Proxies have standard output and error streams which are expected to
16+
/// terminate in a developer-facing console provided by the host.
17+
@since(version = 0.2.0)
18+
import wasi:cli/stdout@0.2.3;
19+
@since(version = 0.2.0)
20+
import wasi:cli/stderr@0.2.3;
21+
22+
/// TODO: this is a temporary workaround until component tooling is able to
23+
/// gracefully handle the absence of stdin. Hosts must return an eof stream
24+
/// for this import, which is what wasi-libc + tooling will do automatically
25+
/// when this import is properly removed.
26+
@since(version = 0.2.0)
27+
import wasi:cli/stdin@0.2.3;
28+
29+
/// This is the default handler to use when user code simply wants to make an
30+
/// HTTP request (e.g., via `fetch()`).
31+
@since(version = 0.2.0)
32+
import outgoing-handler;
33+
}
34+
35+
/// The `wasi:http/proxy` world captures a widely-implementable intersection of
36+
/// hosts that includes HTTP forward and reverse proxies. Components targeting
37+
/// this world may concurrently stream in and out any number of incoming and
38+
/// outgoing HTTP requests.
39+
@since(version = 0.2.0)
40+
world proxy {
41+
@since(version = 0.2.0)
42+
include imports;
43+
44+
/// The host delivers incoming HTTP requests to a component by calling the
45+
/// `handle` function of this exported interface. A host may arbitrarily reuse
46+
/// or not reuse component instance when delivering incoming HTTP requests and
47+
/// thus a component must be able to handle 0..N calls to `handle`.
48+
@since(version = 0.2.0)
49+
export incoming-handler;
50+
}

0 commit comments

Comments
 (0)