Skip to main content

ScheduledRuntimeTaskGroup

Struct ScheduledRuntimeTaskGroup 

Source
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>
where State: Clone + Send + Sync + 'static,

Source

pub fn worker<WorkerFn, WorkerFut>(&mut self, worker: WorkerFn)
where WorkerFn: FnOnce(CancellationToken, State) -> WorkerFut, WorkerFut: Future<Output = ()> + Send + 'static,

Spawns one lease-scoped singleton worker into this group.

Source

pub fn shutdown_token(&self) -> CancellationToken

Returns a clone of the lease-scoped shutdown token.

Source

pub fn state(&self) -> State

Returns a clone of the product runtime state.

Source§

impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
where Name: RegisteredRuntimeTaskKind + Send + Sync + 'static, State: Clone + Send + Sync + 'static, Store: ScheduledTaskStore, PanicFn: Clone + Fn(String) -> Outcome + Send + Sync + 'static, RecordFn: Clone + Send + Sync + 'static, Outcome: Send + 'static,

Source

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>
where State: Freeze, Store: Freeze, PanicFn: Freeze, RecordFn: Freeze,

§

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>
where State: Send, Store: Send, PanicFn: Send, RecordFn: Send, Name: Send, Outcome: Send,

§

impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Sync for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
where State: Sync, Store: Sync, PanicFn: Sync, RecordFn: Sync, Name: Sync, Outcome: Sync,

§

impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> Unpin for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
where State: Unpin, Store: Unpin, PanicFn: Unpin, RecordFn: Unpin, Name: Unpin, Outcome: Unpin,

§

impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> UnsafeUnpin for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>
where State: UnsafeUnpin, Store: UnsafeUnpin, PanicFn: UnsafeUnpin, RecordFn: UnsafeUnpin,

§

impl<'a, Name, State, Store, PanicFn, RecordFn, Outcome> !UnwindSafe for ScheduledRuntimeTaskGroup<'a, Name, State, Store, PanicFn, RecordFn, Outcome>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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