pub struct CronService { /* private fields */ }Expand description
Cron scheduling service.
Maintains a registry of interval-based jobs. The daemon calls
tick() periodically (e.g., every second) and the service fires
any overdue jobs by sending messages through the A2ARouter.
Implementations§
Source§impl CronService
impl CronService
pub fn new() -> Self
Sourcepub fn add_job(
&self,
name: String,
interval_secs: u64,
command: String,
target_pid: Option<Pid>,
) -> CronJob
pub fn add_job( &self, name: String, interval_secs: u64, command: String, target_pid: Option<Pid>, ) -> CronJob
Add a new cron job. Returns the created job.
Sourcepub fn remove_job(&self, id: &str) -> Option<CronJob>
pub fn remove_job(&self, id: &str) -> Option<CronJob>
Remove a job by ID. Returns the removed job if it existed.
Sourcepub fn tick(&self) -> TickResult
pub fn tick(&self) -> TickResult
Tick the scheduler — check all jobs and collect those that are overdue.
Returns the list of job IDs that should fire. The caller is responsible for actually dispatching the messages (to keep CronService decoupled from async A2ARouter).
Sourcepub fn job_snapshot(&self, id: &str) -> Option<CronJob>
pub fn job_snapshot(&self, id: &str) -> Option<CronJob>
Get a snapshot of a job’s current state (for dispatching after tick).
Trait Implementations§
Source§impl Default for CronService
impl Default for CronService
Source§impl SystemService for CronService
impl SystemService for CronService
Source§fn service_type(&self) -> ServiceType
fn service_type(&self) -> ServiceType
Service type category.
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the service.
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the service.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check.
Auto Trait Implementations§
impl !Freeze for CronService
impl RefUnwindSafe for CronService
impl Send for CronService
impl Sync for CronService
impl Unpin for CronService
impl UnsafeUnpin for CronService
impl UnwindSafe for CronService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more