You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace transition-based sandbox evolution with direct snapshot/restore API:
- Remove EvolvableSandbox/DevolvableSandbox trait usage
- Replace transition callbacks with direct method calls
- Add snapshot/restore methods to LoadedWasmSandbox
- Store initial snapshots in WasmSandbox for efficient unloading
- Export Snapshot type in public API
This provides more direct control over sandbox state management
and enables features like checkpoint/restore.
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
// inner is an Option<MultiUseSandbox> as we need to take ownership of it
43
42
// We implement drop on the LoadedWasmSandbox to decrement the count of Sandboxes when it is dropped
44
43
// because of this we cannot implement drop without making inner an Option (alternatively we could make MultiUseSandbox Copy but that would introduce other issues)
45
44
inner:Option<MultiUseSandbox>,
45
+
// The state the sandbox was in before loading a wasm module. Used for transitioning back to a `WasmSandbox` (unloading the wasm module).
46
+
runtime_snapshot:Option<Snapshot>,
46
47
}
47
48
48
-
implSandboxforLoadedWasmSandbox{}
49
-
50
49
implLoadedWasmSandbox{
51
50
/// Call the function in the guest with the name `fn_name`, passing
52
51
/// parameters `params`.
@@ -64,17 +63,50 @@ impl LoadedWasmSandbox {
64
63
None => log_then_return!("No inner MultiUseSandbox to call_guest_function"),
65
64
}
66
65
}
66
+
67
+
/// Take a snapshot of the current state of the sandbox.
68
+
pubfnsnapshot(&mutself) -> Result<Snapshot>{
69
+
match&mutself.inner{
70
+
Some(inner) => inner.snapshot(),
71
+
None => log_then_return!("No inner MultiUseSandbox to snapshot"),
72
+
}
73
+
}
74
+
75
+
/// Restore the state of the sandbox to the state captured in the given snapshot.
0 commit comments