pub trait ServiceJob: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn job_type(&self) -> JobType;
fn period(&self) -> Option<Duration>;
fn schedule(&self) -> Option<TimeOfDay>;
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ServiceResult<Value>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn is_critical(&self) -> bool { ... }
fn stop_gracefully<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A unit of background work managed by JobRegistry.
period supplies the repeat interval for Periodic jobs (defaulting to
60 seconds when the job type needs it but None is returned), and
schedule supplies the daily time for Exact jobs.
Required Methods§
Sourcefn period(&self) -> Option<Duration>
fn period(&self) -> Option<Duration>
Repeat interval for periodic legs; None means no interval configured.
Provided Methods§
Sourcefn is_critical(&self) -> bool
fn is_critical(&self) -> bool
Whether the job is critical. Defaults to false.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".