pub struct WorkflowScheduler { /* private fields */ }Expand description
Workflow scheduler.
Implementations§
Source§impl WorkflowScheduler
impl WorkflowScheduler
Sourcepub fn with_clock(clock: Arc<dyn Clock>) -> Self
pub fn with_clock(clock: Arc<dyn Clock>) -> Self
Create a new scheduler that reads time from the supplied Clock.
Production callers should use Self::new (which uses SystemClock);
this constructor exists so tests can inject a deterministic clock and
drive cron evaluation at logical times without sleeping.
Sourcepub async fn add_schedule(
&self,
workflow: Workflow,
trigger: Trigger,
) -> Result<WorkflowId>
pub async fn add_schedule( &self, workflow: Workflow, trigger: Trigger, ) -> Result<WorkflowId>
Add a scheduled workflow.
Sourcepub async fn remove_schedule(&self, workflow_id: WorkflowId) -> Result<()>
pub async fn remove_schedule(&self, workflow_id: WorkflowId) -> Result<()>
Remove a scheduled workflow.
Sourcepub async fn set_schedule_enabled(
&self,
workflow_id: WorkflowId,
enabled: bool,
) -> Result<()>
pub async fn set_schedule_enabled( &self, workflow_id: WorkflowId, enabled: bool, ) -> Result<()>
Enable/disable a schedule.
Sourcepub async fn list_schedules(&self) -> Vec<(WorkflowId, ScheduledWorkflow)>
pub async fn list_schedules(&self) -> Vec<(WorkflowId, ScheduledWorkflow)>
Get all scheduled workflows.
Sourcepub async fn check_schedules(&self) -> Vec<Workflow>
pub async fn check_schedules(&self) -> Vec<Workflow>
Check for workflows ready to execute.
Sourcepub async fn get_next_execution(
&self,
workflow_id: WorkflowId,
) -> Option<DateTime<Utc>>
pub async fn get_next_execution( &self, workflow_id: WorkflowId, ) -> Option<DateTime<Utc>>
Get next execution time for a workflow.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowScheduler
impl !UnwindSafe for WorkflowScheduler
impl Freeze for WorkflowScheduler
impl Send for WorkflowScheduler
impl Sync for WorkflowScheduler
impl Unpin for WorkflowScheduler
impl UnsafeUnpin for WorkflowScheduler
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