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>
impl<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn> LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
Sourcepub 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
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
Creates configuration for one leased scheduled runtime task group.
Sourcepub const fn lease_renew_interval(self, lease_renew_interval: Duration) -> Self
pub const fn lease_renew_interval(self, lease_renew_interval: Duration) -> Self
Sets the runtime lease renewal interval for the active owner.
Sourcepub const fn lease_standby_retry_interval(
self,
lease_standby_retry_interval: Duration,
) -> Self
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.
Sourcepub 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,
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>
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>
fn clone( &self, ) -> LeasedScheduledRuntimeConfig<Name, Outcome, State, LeaseStore, ScheduleStore, PanicFn, RecordFn>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more