pub struct WorkflowSupervisor { /* private fields */ }Expand description
Continuous, bounded-concurrency host for a WorkflowWorker.
Implementations§
Source§impl WorkflowSupervisor
impl WorkflowSupervisor
Sourcepub fn new(
worker: Arc<WorkflowWorker>,
config: WorkflowSupervisorConfig,
) -> Self
pub fn new( worker: Arc<WorkflowWorker>, config: WorkflowSupervisorConfig, ) -> Self
Creates a continuous supervisor around one shareable worker.
Sourcepub fn with_sleeper(self, sleeper: Arc<dyn WorkflowWorkerSleeper>) -> Self
pub fn with_sleeper(self, sleeper: Arc<dyn WorkflowWorkerSleeper>) -> Self
Overrides supervisor sleeping for deterministic runtimes and tests.
Sourcepub fn with_metrics(self, metrics: WorkflowSupervisorMetrics) -> Self
pub fn with_metrics(self, metrics: WorkflowSupervisorMetrics) -> Self
Uses the supplied cumulative metric set.
Sourcepub const fn metrics(&self) -> &WorkflowSupervisorMetrics
pub const fn metrics(&self) -> &WorkflowSupervisorMetrics
Returns the cumulative metric set used by this supervisor.
Sourcepub async fn run(
&self,
shutdown: &CancellationToken,
) -> WorkflowSupervisorReport
pub async fn run( &self, shutdown: &CancellationToken, ) -> WorkflowSupervisorReport
Continuously polls and executes work until shutdown, then drains started cycles.
Infrastructure errors are counted and retried with backoff. Once shutdown is observed, no replacement cycles are scheduled. Already-started claim or execution operations are awaited so their lease protocol can finish safely.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowSupervisor
impl !UnwindSafe for WorkflowSupervisor
impl Freeze for WorkflowSupervisor
impl Send for WorkflowSupervisor
impl Sync for WorkflowSupervisor
impl Unpin for WorkflowSupervisor
impl UnsafeUnpin for WorkflowSupervisor
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
Mutably borrows from an owned value. Read more