pub struct WasiProcess { /* private fields */ }
Expand description
Represents a process running within the compute state TODO: fields should be private and only accessed via methods.
Implementations§
Source§impl WasiProcess
impl WasiProcess
pub fn acquire_cpu_run_token(&self) -> CpuRunToken
pub fn acquire_cpu_backoff_token( &self, tasks: &Arc<dyn VirtualTaskManager>, ) -> Option<CpuBackoffToken>
Source§impl WasiProcess
impl WasiProcess
pub fn new( pid: WasiProcessId, module_hash: ModuleHash, plane: WasiControlPlaneHandle, ) -> Self
Sourcepub fn pid(&self) -> WasiProcessId
pub fn pid(&self) -> WasiProcessId
Gets the process ID of this process
Sourcepub fn ppid(&self) -> WasiProcessId
pub fn ppid(&self) -> WasiProcessId
Gets the process ID of the parent process
Sourcepub fn lock(&self) -> MutexGuard<'_, WasiProcessInner>
pub fn lock(&self) -> MutexGuard<'_, WasiProcessInner>
Gains access to the process internals
Sourcepub fn new_thread(
&self,
layout: WasiMemoryLayout,
start: ThreadStartType,
) -> Result<WasiThreadHandle, ControlPlaneError>
pub fn new_thread( &self, layout: WasiMemoryLayout, start: ThreadStartType, ) -> Result<WasiThreadHandle, ControlPlaneError>
Creates a a thread and returns it
Sourcepub fn new_thread_with_id(
&self,
layout: WasiMemoryLayout,
start: ThreadStartType,
tid: WasiThreadId,
) -> Result<WasiThreadHandle, ControlPlaneError>
pub fn new_thread_with_id( &self, layout: WasiMemoryLayout, start: ThreadStartType, tid: WasiThreadId, ) -> Result<WasiThreadHandle, ControlPlaneError>
Creates a a thread and returns it
Sourcepub fn get_thread(&self, tid: &WasiThreadId) -> Option<WasiThread>
pub fn get_thread(&self, tid: &WasiThreadId) -> Option<WasiThread>
Gets a reference to a particular thread
Sourcepub fn signal_thread(&self, tid: &WasiThreadId, signal: Signal)
pub fn signal_thread(&self, tid: &WasiThreadId, signal: Signal)
Signals a particular thread in the process
Sourcepub fn signal_process(&self, signal: Signal)
pub fn signal_process(&self, signal: Signal)
Signals all the threads in this process
Sourcepub fn snapshot_and_disable_journaling(
&self,
trigger: SnapshotTrigger,
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
pub fn snapshot_and_disable_journaling( &self, trigger: SnapshotTrigger, ) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
Takes a snapshot of the process and disables journaling returning a future that can be waited on for the snapshot to complete
Note: If you ignore the returned future the checkpoint will still occur but it will execute asynchronously
Sourcepub fn snapshot(
&self,
trigger: SnapshotTrigger,
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
pub fn snapshot( &self, trigger: SnapshotTrigger, ) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
Takes a snapshot of the process
Note: If you ignore the returned future the checkpoint will still occur but it will execute asynchronously
Sourcepub fn disable_journaling_after_checkpoint(&self)
pub fn disable_journaling_after_checkpoint(&self)
Disables the journaling functionality
Sourcepub fn wait_for_checkpoint(
&self,
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
Available on crate feature journal
only.
pub fn wait_for_checkpoint( &self, ) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
journal
only.Wait for the checkout process to finish
Sourcepub fn wait_for_checkpoint_finish(
&self,
) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
Available on crate feature journal
only.
pub fn wait_for_checkpoint_finish( &self, ) -> Pin<Box<dyn Future<Output = ()> + Send + Sync>>
journal
only.Wait for the checkout process to finish
Sourcepub fn signal_interval(
&self,
signal: Signal,
interval: Option<Duration>,
repeat: bool,
)
pub fn signal_interval( &self, signal: Signal, interval: Option<Duration>, repeat: bool, )
Signals one of the threads every interval
Sourcepub fn active_threads(&self) -> u32
pub fn active_threads(&self) -> u32
Returns the number of active threads for this process
Sourcepub async fn join(&self) -> Result<ExitCode, Arc<WasiRuntimeError>>
pub async fn join(&self) -> Result<ExitCode, Arc<WasiRuntimeError>>
Waits until the process is finished.
Sourcepub fn try_join(&self) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
pub fn try_join(&self) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
Attempts to join on the process
Sourcepub async fn join_children(
&mut self,
) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
pub async fn join_children( &mut self, ) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
Waits for all the children to be finished
Sourcepub async fn join_any_child(
&mut self,
) -> Result<Option<(WasiProcessId, ExitCode)>, Errno>
pub async fn join_any_child( &mut self, ) -> Result<Option<(WasiProcessId, ExitCode)>, Errno>
Waits for any of the children to finished
Trait Implementations§
Source§impl Clone for WasiProcess
impl Clone for WasiProcess
Source§fn clone(&self) -> WasiProcess
fn clone(&self) -> WasiProcess
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WasiProcess
impl Debug for WasiProcess
Source§impl SignalHandlerAbi for WasiProcess
impl SignalHandlerAbi for WasiProcess
Auto Trait Implementations§
impl Freeze for WasiProcess
impl !RefUnwindSafe for WasiProcess
impl Send for WasiProcess
impl Sync for WasiProcess
impl Unpin for WasiProcess
impl !UnwindSafe for WasiProcess
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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