pub trait JobRegistry<AppState: AppState> {
// Required methods
fn run_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobFromDB,
app_state: AppState,
cancellation_token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn job_names() -> &'static [&'static str]
where Self: Sized;
}Expand description
A trait for job registries that can dispatch jobs based on their name.
This trait is typically implemented using the impl_job_registry! macro,
which generates the necessary dispatch logic for all registered job types.
Required Methods§
Sourcefn run_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobFromDB,
app_state: AppState,
cancellation_token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job: &'life1 JobFromDB,
app_state: AppState,
cancellation_token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run a job from the database by dispatching to the appropriate handler.
Sourcefn job_names() -> &'static [&'static str]where
Self: Sized,
fn job_names() -> &'static [&'static str]where
Self: Sized,
The names of every job type registered with this registry.
Used for boot-time manifest emission (see crate::eyes_manifest).
The impl_job_registry! macro implements this automatically from the
registered job types’ NAME constants.