-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Roman Volosatovs <[email protected]>
- Loading branch information
1 parent
712d633
commit f7dc5c3
Showing
115 changed files
with
3,557 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
interface store { | ||
/// An error type that encapsulates the different errors that can occur fetching configuration values. | ||
variant error { | ||
/// This indicates an error from an "upstream" config source. | ||
/// As this could be almost _anything_ (such as Vault, Kubernetes ConfigMaps, KeyValue buckets, etc), | ||
/// the error message is a string. | ||
upstream(string), | ||
/// This indicates an error from an I/O operation. | ||
/// As this could be almost _anything_ (such as a file read, network connection, etc), | ||
/// the error message is a string. | ||
/// Depending on how this ends up being consumed, | ||
/// we may consider moving this to use the `wasi:io/error` type instead. | ||
/// For simplicity right now in supporting multiple implementations, it is being left as a string. | ||
io(string), | ||
} | ||
|
||
/// Gets a configuration value of type `string` associated with the `key`. | ||
/// | ||
/// The value is returned as an `option<string>`. If the key is not found, | ||
/// `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned. | ||
get: func( | ||
/// A string key to fetch | ||
key: string | ||
) -> result<option<string>, error>; | ||
|
||
/// Gets a list of configuration key-value pairs of type `string`. | ||
/// | ||
/// If an error occurs, an `Err(error)` is returned. | ||
get-all: func() -> result<list<tuple<string, string>>, error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package wasi:config@0.2.0-draft; | ||
|
||
world imports { | ||
/// The interface for wasi:config/store | ||
import store; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/// This interface defines a handler of incoming HTTP Requests. It should | ||
/// be exported by components which can respond to HTTP Requests. | ||
@since(version = 0.2.0) | ||
interface incoming-handler { | ||
@since(version = 0.2.0) | ||
use types.{incoming-request, response-outparam}; | ||
|
||
/// This function is invoked with an incoming HTTP Request, and a resource | ||
/// `response-outparam` which provides the capability to reply with an HTTP | ||
/// Response. The response is sent by calling the `response-outparam.set` | ||
/// method, which allows execution to continue after the response has been | ||
/// sent. This enables both streaming to the response body, and performing other | ||
/// work. | ||
/// | ||
/// The implementor of this function must write a response to the | ||
/// `response-outparam` before returning, or else the caller will respond | ||
/// with an error on its behalf. | ||
@since(version = 0.2.0) | ||
handle: func( | ||
request: incoming-request, | ||
response-out: response-outparam | ||
); | ||
} | ||
|
||
/// This interface defines a handler of outgoing HTTP Requests. It should be | ||
/// imported by components which wish to make HTTP Requests. | ||
@since(version = 0.2.0) | ||
interface outgoing-handler { | ||
@since(version = 0.2.0) | ||
use types.{ | ||
outgoing-request, request-options, future-incoming-response, error-code | ||
}; | ||
|
||
/// This function is invoked with an outgoing HTTP Request, and it returns | ||
/// a resource `future-incoming-response` which represents an HTTP Response | ||
/// which may arrive in the future. | ||
/// | ||
/// The `options` argument accepts optional parameters for the HTTP | ||
/// protocol's transport layer. | ||
/// | ||
/// This function may return an error if the `outgoing-request` is invalid | ||
/// or not allowed to be made. Otherwise, protocol errors are reported | ||
/// through the `future-incoming-response`. | ||
@since(version = 0.2.0) | ||
handle: func( | ||
request: outgoing-request, | ||
options: option<request-options> | ||
) -> result<future-incoming-response, error-code>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package wasi:http@0.2.3; | ||
|
||
/// The `wasi:http/imports` world imports all the APIs for HTTP proxies. | ||
/// It is intended to be `include`d in other worlds. | ||
@since(version = 0.2.0) | ||
world imports { | ||
/// HTTP proxies have access to time and randomness. | ||
@since(version = 0.2.0) | ||
import wasi:clocks/monotonic-clock@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:clocks/wall-clock@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:random/random@0.2.3; | ||
|
||
/// Proxies have standard output and error streams which are expected to | ||
/// terminate in a developer-facing console provided by the host. | ||
@since(version = 0.2.0) | ||
import wasi:cli/stdout@0.2.3; | ||
@since(version = 0.2.0) | ||
import wasi:cli/stderr@0.2.3; | ||
|
||
/// TODO: this is a temporary workaround until component tooling is able to | ||
/// gracefully handle the absence of stdin. Hosts must return an eof stream | ||
/// for this import, which is what wasi-libc + tooling will do automatically | ||
/// when this import is properly removed. | ||
@since(version = 0.2.0) | ||
import wasi:cli/stdin@0.2.3; | ||
|
||
/// This is the default handler to use when user code simply wants to make an | ||
/// HTTP request (e.g., via `fetch()`). | ||
@since(version = 0.2.0) | ||
import outgoing-handler; | ||
} | ||
|
||
/// The `wasi:http/proxy` world captures a widely-implementable intersection of | ||
/// hosts that includes HTTP forward and reverse proxies. Components targeting | ||
/// this world may concurrently stream in and out any number of incoming and | ||
/// outgoing HTTP requests. | ||
@since(version = 0.2.0) | ||
world proxy { | ||
@since(version = 0.2.0) | ||
include imports; | ||
|
||
/// The host delivers incoming HTTP requests to a component by calling the | ||
/// `handle` function of this exported interface. A host may arbitrarily reuse | ||
/// or not reuse component instance when delivering incoming HTTP requests and | ||
/// thus a component must be able to handle 0..N calls to `handle`. | ||
@since(version = 0.2.0) | ||
export incoming-handler; | ||
} |
Oops, something went wrong.