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() -> CronService
Sourcepub fn add_job(
&self,
name: String,
interval_secs: u64,
command: String,
target_pid: Option<u64>,
) -> CronJob
pub fn add_job( &self, name: String, interval_secs: u64, command: String, target_pid: Option<u64>, ) -> 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§fn default() -> CronService
fn default() -> CronService
Returns the “default value” for a type. Read more
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
'life0: 'async_trait,
CronService: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
CronService: '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
'life0: 'async_trait,
CronService: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
CronService: 'async_trait,
Stop the service.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
'life0: 'async_trait,
CronService: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
'life0: 'async_trait,
CronService: 'async_trait,
Perform a health check.
Source§fn liveness_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn liveness_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Liveness probe (K2b-G2, os-patterns). Read more
Source§fn readiness_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn readiness_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ProbeResult> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Readiness probe (K2b-G2, os-patterns). Read more
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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