pub struct MonitorContext { /* private fields */ }Expand description
A handle to the monitor which allows probing Shared context for the monitor, providing access to the shutdown handle and the set of workers it supervises.
Implementations§
Source§impl MonitorContext
impl MonitorContext
Sourcepub fn workers(&self) -> &Vec<WorkerContext>
pub fn workers(&self) -> &Vec<WorkerContext>
Returns a reference to all workers managed by this monitor.
Sourcepub fn shutdown(&self) -> Result<(), MonitorError>
pub fn shutdown(&self) -> Result<(), MonitorError>
Initiates a shutdown of the monitor.
This signals the shutdown handle but does not block waiting for workers to finish.
Sourcepub fn resume_worker(&self, name: &str) -> Result<(), WorkerError>
pub fn resume_worker(&self, name: &str) -> Result<(), WorkerError>
Resumes the worker with the given name.
§Errors
Returns WorkerError if no worker with name exists, or if
the resume itself fails.
Sourcepub fn pause_worker(&self, name: &str) -> Result<(), WorkerError>
pub fn pause_worker(&self, name: &str) -> Result<(), WorkerError>
Pauses the worker with the given name.
§Errors
Returns WorkerError if no worker with name exists, or if
pausing fails.
Sourcepub fn stop_worker(&self, name: &str) -> Result<(), WorkerError>
pub fn stop_worker(&self, name: &str) -> Result<(), WorkerError>
Stops the worker with the given name.
§Errors
Returns WorkerError if no worker with name exists, or if
stopping fails.
Sourcepub fn wake_worker(&self, name: &str) -> Result<(), WorkerError>
pub fn wake_worker(&self, name: &str) -> Result<(), WorkerError>
Sourcepub fn get_worker(&self, name: &str) -> Result<&WorkerContext, WorkerError>
pub fn get_worker(&self, name: &str) -> Result<&WorkerContext, WorkerError>
Looks up a worker by name.
§Errors
Returns WorkerError::StateError if no worker with name
exists among the managed workers.
Sourcepub fn cancel_task(
&self,
worker: &str,
task_id: &str,
) -> Result<(), BoxDynError>
Available on crate feature task-context only.
pub fn cancel_task( &self, worker: &str, task_id: &str, ) -> Result<(), BoxDynError>
task-context only.Attempt to cancel a task