pub struct ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome> { /* private fields */ }Expand description
Lease-scoped task group used by product registration closures.
A value of this type exists only while Forge is building the worker group
for one lease acquisition. Use Self::worker for singleton workers that
should run only on the active owner, and Self::scheduled for tasks that
should additionally coordinate each firing through the scheduled task
catalog.
Implementations§
Source§impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
Sourcepub fn worker<WorkerFn, WorkerFut>(&mut self, worker: WorkerFn)
pub fn worker<WorkerFn, WorkerFut>(&mut self, worker: WorkerFn)
Spawns one lease-scoped singleton worker into this group.
Sourcepub fn shutdown_token(&self) -> CancellationToken
pub fn shutdown_token(&self) -> CancellationToken
Returns a clone of the lease-scoped shutdown token.
Source§impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
Sourcepub fn scheduled<IntervalFn, TaskFn, TaskFut, RecordFut>(
&mut self,
name: Name,
interval_fn: IntervalFn,
jitter_cap: Option<Duration>,
task_fn: TaskFn,
)where
IntervalFn: Fn(&State) -> Duration + Send + Sync + 'static,
TaskFn: Fn(State) -> TaskFut + Send + Sync + 'static,
TaskFut: Future<Output = Outcome> + Send + 'static,
RecordFn: Fn(State, Name, ScheduledTaskClaim, DateTime<Utc>, DateTime<Utc>, Outcome) -> RecordFut,
RecordFut: Future<Output = ()> + Send + 'static,
pub fn scheduled<IntervalFn, TaskFn, TaskFut, RecordFut>(
&mut self,
name: Name,
interval_fn: IntervalFn,
jitter_cap: Option<Duration>,
task_fn: TaskFn,
)where
IntervalFn: Fn(&State) -> Duration + Send + Sync + 'static,
TaskFn: Fn(State) -> TaskFut + Send + Sync + 'static,
TaskFut: Future<Output = Outcome> + Send + 'static,
RecordFn: Fn(State, Name, ScheduledTaskClaim, DateTime<Utc>, DateTime<Utc>, Outcome) -> RecordFut,
RecordFut: Future<Output = ()> + Send + 'static,
Registers one scheduled runtime task in the lease-scoped worker group.
Auto Trait Implementations§
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Freeze for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> !RefUnwindSafe for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Send for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Sync for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Unpin for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> UnsafeUnpin for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> !UnwindSafe for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
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