pub struct HotReloadablePlugin { /* private fields */ }Expand description
A hot-reloadable plugin wrapper
Implementations§
Source§impl HotReloadablePlugin
impl HotReloadablePlugin
Sourcepub fn new(
name: &str,
instance: Arc<WasmPluginInstance>,
manifest: PluginManifest,
) -> Self
pub fn new( name: &str, instance: Arc<WasmPluginInstance>, manifest: PluginManifest, ) -> Self
Create a new hot-reloadable plugin
Sourcepub fn current(&self) -> Arc<WasmPluginInstance>
pub fn current(&self) -> Arc<WasmPluginInstance>
Get the current active instance
Sourcepub fn call(
&self,
func_name: &str,
args: &[WasmValue],
) -> KernelResult<Vec<WasmValue>>
pub fn call( &self, func_name: &str, args: &[WasmValue], ) -> KernelResult<Vec<WasmValue>>
Call a function, tracking the epoch
Sourcepub fn prepare_upgrade(
&self,
wasm_bytes: &[u8],
new_manifest: PluginManifest,
) -> KernelResult<()>
pub fn prepare_upgrade( &self, wasm_bytes: &[u8], new_manifest: PluginManifest, ) -> KernelResult<()>
Prepare an upgrade with new WASM bytes
Sourcepub fn execute_upgrade(&self) -> KernelResult<()>
pub fn execute_upgrade(&self) -> KernelResult<()>
Execute the upgrade
Sourcepub fn upgrade(
&self,
wasm_bytes: &[u8],
new_manifest: PluginManifest,
) -> KernelResult<()>
pub fn upgrade( &self, wasm_bytes: &[u8], new_manifest: PluginManifest, ) -> KernelResult<()>
Perform a full upgrade (prepare + execute)
Sourcepub fn cancel_upgrade(&self) -> KernelResult<()>
pub fn cancel_upgrade(&self) -> KernelResult<()>
Cancel a pending upgrade
Sourcepub fn state(&self) -> HotReloadState
pub fn state(&self) -> HotReloadState
Get current state
Sourcepub fn stats(&self) -> HotReloadStats
pub fn stats(&self) -> HotReloadStats
Get statistics
Sourcepub fn manifest(&self) -> PluginManifest
pub fn manifest(&self) -> PluginManifest
Get current manifest
Sourcepub fn set_drain_timeout(&mut self, timeout: Duration)
pub fn set_drain_timeout(&mut self, timeout: Duration)
Set drain timeout
Auto Trait Implementations§
impl !Freeze for HotReloadablePlugin
impl !RefUnwindSafe for HotReloadablePlugin
impl Send for HotReloadablePlugin
impl Sync for HotReloadablePlugin
impl Unpin for HotReloadablePlugin
impl UnsafeUnpin for HotReloadablePlugin
impl !UnwindSafe for HotReloadablePlugin
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