pub struct WasmSandboxRuntime { /* private fields */ }Expand description
WASM sandbox runtime manager
Manages multiple isolated WASM sandboxes with:
- Memory isolation between plugins
- Resource limits (memory, fuel)
- Capability-based access control
- Connection pooling for efficiency
Implementations§
Source§impl WasmSandboxRuntime
impl WasmSandboxRuntime
Sourcepub fn new(
config: SandboxConfig,
host_context: Arc<dyn HostContextProvider + Send + Sync>,
) -> Self
pub fn new( config: SandboxConfig, host_context: Arc<dyn HostContextProvider + Send + Sync>, ) -> Self
Create a new sandbox runtime
Sourcepub fn load_plugin(
&self,
plugin_id: &str,
wasm_bytes: &[u8],
manifest: PluginManifest,
) -> Result<(), SandboxError>
pub fn load_plugin( &self, plugin_id: &str, wasm_bytes: &[u8], manifest: PluginManifest, ) -> Result<(), SandboxError>
Load a plugin from WASM bytes
Sourcepub fn invoke(
&self,
plugin_id: &str,
function: &str,
args: &[SandboxValue],
) -> Result<Vec<SandboxValue>, SandboxError>
pub fn invoke( &self, plugin_id: &str, function: &str, args: &[SandboxValue], ) -> Result<Vec<SandboxValue>, SandboxError>
Invoke a function in a plugin sandbox
Sourcepub fn unload_plugin(&self, plugin_id: &str) -> Result<(), SandboxError>
pub fn unload_plugin(&self, plugin_id: &str) -> Result<(), SandboxError>
Unload a plugin
Sourcepub fn hot_reload(
&self,
plugin_id: &str,
new_wasm_bytes: &[u8],
new_manifest: PluginManifest,
) -> Result<(), SandboxError>
pub fn hot_reload( &self, plugin_id: &str, new_wasm_bytes: &[u8], new_manifest: PluginManifest, ) -> Result<(), SandboxError>
Hot-reload a plugin
Sourcepub fn get_plugin_stats(
&self,
plugin_id: &str,
) -> Result<SandboxStats, SandboxError>
pub fn get_plugin_stats( &self, plugin_id: &str, ) -> Result<SandboxStats, SandboxError>
Get plugin statistics
Sourcepub fn get_runtime_stats(&self) -> SandboxRuntimeStats
pub fn get_runtime_stats(&self) -> SandboxRuntimeStats
Get global runtime statistics
Sourcepub fn list_plugins(&self) -> Vec<PluginInfo>
pub fn list_plugins(&self) -> Vec<PluginInfo>
List all loaded plugins
Sourcepub fn reset_fuel(&self, plugin_id: &str) -> Result<(), SandboxError>
pub fn reset_fuel(&self, plugin_id: &str) -> Result<(), SandboxError>
Reset fuel for a plugin
Auto Trait Implementations§
impl !Freeze for WasmSandboxRuntime
impl !RefUnwindSafe for WasmSandboxRuntime
impl Send for WasmSandboxRuntime
impl Sync for WasmSandboxRuntime
impl Unpin for WasmSandboxRuntime
impl UnsafeUnpin for WasmSandboxRuntime
impl !UnwindSafe for WasmSandboxRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more