Skip to main content

LeasedScheduledRuntimeConfig

Struct LeasedScheduledRuntimeConfig 

Source
pub struct LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> { /* private fields */ }
Expand description

Configuration for a leased group of scheduled runtime tasks.

This is the high-level entrypoint for multi-instance Aster services. Forge generates the process owner id, supervises the runtime lease, creates the lease-scoped BackgroundTasks group, and wires every declared scheduled task into the shared catalog store. Product code only declares singleton workers and scheduled task bodies through ScheduledRuntimeTaskGroup.

Implementations§

Source§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>

Source

pub fn new<RecordFut>( namespace: &'static str, lease_id: impl Into<String>, lease_store: LeaseStore, schedule_store: ScheduleStore, state: State, panic_outcome: PanicFn, record_outcome: RecordFn, ) -> Self
where PanicFn: Fn(String) -> Outcome, RecordFn: Fn(State, Name, ScheduledTaskClaim, DateTime<Utc>, DateTime<Utc>, Outcome) -> RecordFut, RecordFut: Future<Output = ()> + Send + 'static,

Creates configuration for one leased scheduled runtime task group.

Source

pub const fn claim_ttl(self, claim_ttl: Duration) -> Self

Sets the scheduled task claim TTL.

Source

pub const fn lease_ttl(self, lease_ttl: Duration) -> Self

Sets the runtime lease TTL.

Source

pub const fn lease_renew_interval(self, lease_renew_interval: Duration) -> Self

Sets the runtime lease renewal interval for the active owner.

Source

pub const fn lease_standby_retry_interval( self, lease_standby_retry_interval: Duration, ) -> Self

Sets the standby retry interval while another process owns the lease.

Source

pub async fn run<ConfigureFn>( self, shutdown_token: CancellationToken, configure: ConfigureFn, )
where Name: RegisteredRuntimeTaskKind + Send + Sync + 'static, State: Clone + Send + Sync + 'static, LeaseStore: RuntimeLeaseStore, ScheduleStore: ScheduledTaskStore, ConfigureFn: for<'a> FnMut(&mut ScheduledRuntimeTaskGroup<'a, Name, State, ScheduleStore, PanicFn, RecordFn, Outcome>) + Send + 'static, PanicFn: Clone + Fn(String) -> Outcome + Send + Sync + 'static, RecordFn: Clone + Send + Sync + 'static, Outcome: Send + 'static,

Runs this configured leased scheduled runtime group until shutdown.

Prefer this method at product entrypoints because it keeps the call shaped like a component declaration: configure shared resources once, then declare workers and scheduled tasks in the closure.

Trait Implementations§

Source§

impl<Name: Clone, Outcome: Clone, State: Clone, LeaseStore: Clone, ScheduleStore: Clone, PanicFn: Clone, RecordFn: Clone> Clone for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>

Source§

fn clone( &self, ) -> LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> Freeze for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: Freeze, ScheduleStore: Freeze, State: Freeze, PanicFn: Freeze, RecordFn: Freeze,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> RefUnwindSafe for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: RefUnwindSafe, ScheduleStore: RefUnwindSafe, State: RefUnwindSafe, PanicFn: RefUnwindSafe, RecordFn: RefUnwindSafe,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> Send for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: Send, ScheduleStore: Send, State: Send, PanicFn: Send, RecordFn: Send,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> Sync for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: Sync, ScheduleStore: Sync, State: Sync, PanicFn: Sync, RecordFn: Sync,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> Unpin for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: Unpin, ScheduleStore: Unpin, State: Unpin, PanicFn: Unpin, RecordFn: Unpin,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> UnsafeUnpin for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: UnsafeUnpin, ScheduleStore: UnsafeUnpin, State: UnsafeUnpin, PanicFn: UnsafeUnpin, RecordFn: UnsafeUnpin,

§

impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> UnwindSafe for LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
where LeaseStore: UnwindSafe, ScheduleStore: UnwindSafe, State: UnwindSafe, PanicFn: UnwindSafe, RecordFn: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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