docs(wit): document capability and component contracts
This commit is contained in:
@@ -1,11 +1,34 @@
|
||||
package wasmeld:service@0.1.0;
|
||||
|
||||
/// Minimum request/response lifecycle implemented by every Wasmeld service.
|
||||
///
|
||||
/// The Runtime creates one Component Store per Actor, calls `init` once, then
|
||||
/// serializes `invoke` calls through that Actor's bounded mailbox. Component
|
||||
/// memory can therefore remain warm between calls, but it is not durable and
|
||||
/// is lost when the Actor or process restarts.
|
||||
world service-component {
|
||||
/// Application-level failures returned without trapping the Component.
|
||||
///
|
||||
/// Traps, fuel exhaustion, deadline interruption, and invalid ABI data are
|
||||
/// Runtime failures and do not use this variant.
|
||||
variant service-error {
|
||||
/// The Actor cannot accept calls because its initial configuration failed.
|
||||
init-failed(string),
|
||||
/// This input could not be processed; a later call may still succeed.
|
||||
call-failed(string),
|
||||
}
|
||||
|
||||
/// Initializes a newly created Actor Store.
|
||||
///
|
||||
/// `config` is opaque to the platform. Return `init-failed` for expected
|
||||
/// configuration errors; do not retain borrowed views into this byte list.
|
||||
export init: func(config: list<u8>) -> result<_, service-error>;
|
||||
|
||||
/// Processes one opaque request and returns one opaque response.
|
||||
///
|
||||
/// The management API represents these bytes as base64, while the public
|
||||
/// gateway transports them as `application/octet-stream`. The Component
|
||||
/// should return promptly and use the resident actor contract for long-lived
|
||||
/// I/O instead of blocking this call in an internal loop.
|
||||
export invoke: func(input: list<u8>) -> result<list<u8>, service-error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user