feat(runtime): modularize host capabilities
- add an exact-version Capability Registry and structured descriptors - move Clock bindings, host state, and Linker installation into its own module - derive required capabilities from Component imports and link only requested interfaces - cover exact-version resolution and minimal per-component capability sets
This commit is contained in:
@@ -16,6 +16,7 @@ fn echo_component_round_trips_bytes() {
|
||||
let runtime = Runtime::new(RuntimeConfig::default()).expect("runtime should start");
|
||||
let (key, actor) = start_component(&runtime, "echo", "echo_component.wasm");
|
||||
|
||||
assert!(runtime.capabilities(&key).unwrap().is_empty());
|
||||
assert_eq!(actor.invoke(b"hello wasm".to_vec()).unwrap(), b"hello wasm");
|
||||
|
||||
runtime.stop(&key).unwrap();
|
||||
@@ -171,6 +172,13 @@ fn explicit_clock_capability_is_linked() {
|
||||
let runtime = Runtime::new(RuntimeConfig::default()).expect("runtime should start");
|
||||
let (key, actor) = start_component(&runtime, "clock-probe", "clock_probe_component.wasm");
|
||||
|
||||
let capabilities = runtime.capabilities(&key).unwrap();
|
||||
assert_eq!(capabilities.len(), 1);
|
||||
assert_eq!(
|
||||
capabilities[0].interface(),
|
||||
"wasmeld:clock/monotonic-clock@0.1.0"
|
||||
);
|
||||
|
||||
let first = actor.invoke(b"first".to_vec()).unwrap();
|
||||
let second = actor.invoke(b"second".to_vec()).unwrap();
|
||||
assert_eq!(&first[8..], b"first");
|
||||
|
||||
Reference in New Issue
Block a user