pub struct SchedulerJobRecord {
pub id: QName,
pub status: SchedulerJobStatus,
pub next_fire_at: Option<SystemTime>,
pub last_started_at: Option<SystemTime>,
pub last_finished_at: Option<SystemTime>,
pub consecutive_failures: u32,
pub schedule: Schedule,
pub cancel: CancellationToken,
}Expand description
Persistable record of a scheduled job’s state.
Round-trips through uni_system.background_jobs in M11 cutover.
Fields§
§id: QNameJob id.
status: SchedulerJobStatusLifecycle status.
next_fire_at: Option<SystemTime>When the next fire of this job is due. None for Manual
schedules until Scheduler::add_job marks the job Pending,
at which point it is eligible immediately.
last_started_at: Option<SystemTime>When the most-recent run started.
last_finished_at: Option<SystemTime>When the most-recent run finished.
consecutive_failures: u32Number of consecutive failures since the last success.
schedule: ScheduleSchedule describing when fires are eligible.
cancel: CancellationTokenCancellation token; flipped on cancel() or shutdown.
Implementations§
Source§impl SchedulerJobRecord
impl SchedulerJobRecord
Sourcepub fn pending(id: QName) -> Self
pub fn pending(id: QName) -> Self
Construct a pending record with the legacy Manual schedule.
Equivalent to pending_with_schedule(id, Schedule::Manual, SystemTime::now()).
Sourcepub fn pending_with_schedule(
id: QName,
schedule: Schedule,
now: SystemTime,
) -> Self
pub fn pending_with_schedule( id: QName, schedule: Schedule, now: SystemTime, ) -> Self
Construct a pending record with an explicit schedule.
now is used both as the initial registration instant and as
the reference point for the first next_fire_at computation.
Trait Implementations§
Source§impl Clone for SchedulerJobRecord
impl Clone for SchedulerJobRecord
Source§fn clone(&self) -> SchedulerJobRecord
fn clone(&self) -> SchedulerJobRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchedulerJobRecord
impl Debug for SchedulerJobRecord
Source§impl PartialEq for SchedulerJobRecord
impl PartialEq for SchedulerJobRecord
Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Two records are equal iff all their persisted state matches.
Previously this compared only id and status, so two records
that differed in schedule, next_fire_at, or
consecutive_failures (i.e. genuinely-different job states)
would still compare equal. The cancel field is intentionally
excluded because it is per-process identity (an Arc<AtomicBool>)
and is not part of the persisted record.
Auto Trait Implementations§
impl Freeze for SchedulerJobRecord
impl RefUnwindSafe for SchedulerJobRecord
impl Send for SchedulerJobRecord
impl Sync for SchedulerJobRecord
impl Unpin for SchedulerJobRecord
impl UnsafeUnpin for SchedulerJobRecord
impl UnwindSafe for SchedulerJobRecord
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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