pub struct WorkerHandle { /* private fields */ }Expand description
Handle to a spawned DurableWorker loop.
Implementations§
Source§impl WorkerHandle
impl WorkerHandle
Sourcepub fn wake(&self)
pub fn wake(&self)
Makes the loop try a claim now instead of after its poll interval, for example right after this process enqueued a run.
Sourcepub fn heartbeat_now(&self)
pub fn heartbeat_now(&self)
Makes every in-flight attempt heartbeat now, so a cancellation requested through the run store is seen at once rather than at the next heartbeat interval.
Sourcepub fn suspend(&self, run_id: &str) -> bool
pub fn suspend(&self, run_id: &str) -> bool
Asks the agent run run_id, in flight on this worker, to stop at its next model-call
boundary and park as Waiting on its Session checkpoint until woken (spec 3.2 §10
S1). Returns whether the request reached an attempt; see
DurableWorker::suspend.
Sourcepub async fn wake_frozen(&self) -> usize
pub async fn wake_frozen(&self) -> usize
Wakes every run the worker parked under a freeze and returns how many it woke
(spec 3.2 §10 S3); see DurableWorker::wake_frozen.
Sourcepub fn frozen_runs(&self) -> Vec<String>
pub fn frozen_runs(&self) -> Vec<String>
The ids of the runs the worker parked under a freeze and has not woken yet.
Sourcepub async fn shutdown(self)
pub async fn shutdown(self)
Stops claiming and waits for in-flight attempts to finish and write their outcome.
Sourcepub fn abort(&self)
pub fn abort(&self)
Drops the loop and every in-flight attempt without writing, as a crash would. Their leases expire and another worker recovers the runs.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the loop has ended.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WorkerHandle
impl !UnwindSafe for WorkerHandle
impl Forget for WorkerHandle
impl Freeze for WorkerHandlewhere
*const ArcInner<TreeNode> is !null: Freeze,
PhantomData<ArcInner<TreeNode>>: Freeze,
*const Header is !null: Freeze,
PhantomData<()>: Freeze,
*const ArcInner<Notify> is !null: Freeze,
PhantomData<ArcInner<Notify>>: Freeze,
*const ArcInner<Suspensions> is !null: Freeze,
PhantomData<ArcInner<Suspensions>>: Freeze,
*const ArcInner<FrozenRuns> is !null: Freeze,
PhantomData<ArcInner<FrozenRuns>>: Freeze,
*const ArcInner<dyn DurableRunStore> is !null: Freeze,
PhantomData<ArcInner<dyn DurableRunStore>>: Freeze,
impl Move for WorkerHandle
impl Send for WorkerHandle
impl Sync for WorkerHandle
impl Unpin for WorkerHandle
impl UnsafeUnpin for WorkerHandlewhere
*const ArcInner<TreeNode> is !null: UnsafeUnpin,
PhantomData<ArcInner<TreeNode>>: UnsafeUnpin,
*const Header is !null: UnsafeUnpin,
PhantomData<()>: UnsafeUnpin,
*const ArcInner<Notify> is !null: UnsafeUnpin,
PhantomData<ArcInner<Notify>>: UnsafeUnpin,
*const ArcInner<Suspensions> is !null: UnsafeUnpin,
PhantomData<ArcInner<Suspensions>>: UnsafeUnpin,
*const ArcInner<FrozenRuns> is !null: UnsafeUnpin,
PhantomData<ArcInner<FrozenRuns>>: UnsafeUnpin,
*const ArcInner<dyn DurableRunStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn DurableRunStore>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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