2026-07-27 04:59:33 +08:00
|
|
|
package wasmeld:service@0.1.0;
|
|
|
|
|
|
2026-07-30 08:13:24 +08:00
|
|
|
/// 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.
|
2026-07-27 04:59:33 +08:00
|
|
|
world service-component {
|
2026-07-30 08:13:24 +08:00
|
|
|
/// 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.
|
2026-07-27 04:59:33 +08:00
|
|
|
variant service-error {
|
2026-07-30 08:13:24 +08:00
|
|
|
/// The Actor cannot accept calls because its initial configuration failed.
|
2026-07-27 04:59:33 +08:00
|
|
|
init-failed(string),
|
2026-07-30 08:13:24 +08:00
|
|
|
/// This input could not be processed; a later call may still succeed.
|
2026-07-27 04:59:33 +08:00
|
|
|
call-failed(string),
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 08:13:24 +08:00
|
|
|
/// 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.
|
2026-07-27 04:59:33 +08:00
|
|
|
export init: func(config: list<u8>) -> result<_, service-error>;
|
2026-07-30 08:13:24 +08:00
|
|
|
|
|
|
|
|
/// 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.
|
2026-07-27 04:59:33 +08:00
|
|
|
export invoke: func(input: list<u8>) -> result<list<u8>, service-error>;
|
|
|
|
|
}
|