pub struct WorkerHandle<B> { /* private fields */ }Expand description
A cloneable handle for interacting with a running PooledWorker.
Obtained from PooledWorker::spawn. The handle is cheap to clone and can
be shared across tasks. Dropping all handles triggers a graceful
shutdown of the worker (equivalent to calling shutdown).
Implementations§
Source§impl<B> WorkerHandle<B>
impl<B> WorkerHandle<B>
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Request a graceful shutdown of the worker.
The worker will finish its current task (if any) and then exit. This is a non-async, fire-and-forget operation — errors are ignored (the actor may have already stopped).
Source§impl<B: SignalStore> WorkerHandle<B>
impl<B: SignalStore> WorkerHandle<B>
Sourcepub async fn cancel_workflow(
&self,
instance_id: &str,
reason: Option<String>,
cancelled_by: Option<String>,
) -> Result<(), RuntimeError>
pub async fn cancel_workflow( &self, instance_id: &str, reason: Option<String>, cancelled_by: Option<String>, ) -> Result<(), RuntimeError>
Request cancellation of a workflow.
This stores a cancel signal directly in the backend. The worker will pick it up at the next guard check (task boundary).
§Errors
Returns an error if the signal cannot be stored (workflow not found or in terminal state).
Sourcepub async fn pause_workflow(
&self,
instance_id: &str,
reason: Option<String>,
paused_by: Option<String>,
) -> Result<(), RuntimeError>
pub async fn pause_workflow( &self, instance_id: &str, reason: Option<String>, paused_by: Option<String>, ) -> Result<(), RuntimeError>
Request pausing of a workflow.
This stores a pause signal directly in the backend. The worker will pick it up at the next guard check (task boundary).
§Errors
Returns an error if the signal cannot be stored (workflow not found or in terminal/paused state).
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for WorkerHandle<B>
impl<B> !RefUnwindSafe for WorkerHandle<B>
impl<B> Send for WorkerHandle<B>
impl<B> Sync for WorkerHandle<B>
impl<B> Unpin for WorkerHandle<B>
impl<B> UnsafeUnpin for WorkerHandle<B>
impl<B> !UnwindSafe for WorkerHandle<B>
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§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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.