cfac7d85f0
- define versioned service and clock WIT contracts - enforce import allowlists, fuel, epoch, memory, I/O, and mailbox limits - keep one Store and Component Instance resident per serial Actor - add echo, counter, fault, spin, and capability probe components - cover lifecycle, concurrency, sandbox, and fault recovery behavior
25 lines
608 B
Rust
25 lines
608 B
Rust
mod bindings {
|
|
wit_bindgen::generate!({
|
|
path: "wit",
|
|
world: "clock-probe-component",
|
|
generate_all,
|
|
});
|
|
}
|
|
|
|
struct ClockProbe;
|
|
|
|
impl bindings::Guest for ClockProbe {
|
|
fn init(_config: Vec<u8>) -> Result<(), bindings::ServiceError> {
|
|
Ok(())
|
|
}
|
|
|
|
fn invoke(input: Vec<u8>) -> Result<Vec<u8>, bindings::ServiceError> {
|
|
let now = bindings::wasmeld::clock::monotonic_clock::now();
|
|
let mut output = now.to_le_bytes().to_vec();
|
|
output.extend_from_slice(&input);
|
|
Ok(output)
|
|
}
|
|
}
|
|
|
|
bindings::export!(ClockProbe with_types_in bindings);
|