Skip to main content

WorkerHandle

Struct WorkerHandle 

Source
pub struct WorkerHandle { /* private fields */ }
Expand description

Handle to a spawned DurableWorker loop.

Implementations§

Source§

impl WorkerHandle

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn frozen_runs(&self) -> Vec<String>

The ids of the runs the worker parked under a freeze and has not woken yet.

Source

pub async fn shutdown(self)

Stops claiming and waits for in-flight attempts to finish and write their outcome.

Source

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.

Source

pub fn is_finished(&self) -> bool

Whether the loop has ended.

Trait Implementations§

Source§

impl Debug for WorkerHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for WorkerHandle

§

impl !UnwindSafe for WorkerHandle

§

impl Forget for WorkerHandle

§

impl Freeze for WorkerHandle
where *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
where Arc<TreeNode>: Send, JoinHandle<()>: Send, Arc<Notify>: Send, Arc<Suspensions>: Send, Arc<FrozenRuns>: Send, Arc<dyn DurableRunStore>: Send,

§

impl Sync for WorkerHandle
where Arc<TreeNode>: Sync, JoinHandle<()>: Sync, Arc<Notify>: Sync, Arc<Suspensions>: Sync, Arc<FrozenRuns>: Sync, Arc<dyn DurableRunStore>: Sync,

§

impl Unpin for WorkerHandle
where Arc<TreeNode>: Unpin, JoinHandle<()>: Unpin, Arc<Notify>: Unpin, Arc<Suspensions>: Unpin, Arc<FrozenRuns>: Unpin, Arc<dyn DurableRunStore>: Unpin,

§

impl UnsafeUnpin for WorkerHandle
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more