pub struct JobWrapper {
pub id: String,
pub name: String,
pub payload: Value,
pub status: JobStatus,
pub attempts: u32,
pub max_retries: u32,
pub created_at: i64,
pub scheduled_at: Option<i64>,
pub priority: i32,
pub cron_schedule: Option<String>,
pub last_run_at: Option<i64>,
pub error: Option<String>,
}Expand description
Job wrapper for storage
Fields§
§id: String§name: String§payload: Value§status: JobStatus§attempts: u32§max_retries: u32§created_at: i64§scheduled_at: Option<i64>§priority: i32§cron_schedule: Option<String>§last_run_at: Option<i64>§error: Option<String>Implementations§
Source§impl JobWrapper
impl JobWrapper
pub fn new<J: Job>(job: &J) -> Result<Self>
pub fn with_delay(self, delay: Duration) -> Self
Sourcepub fn with_cron(self, cron_expr: String) -> Self
pub fn with_cron(self, cron_expr: String) -> Self
Schedule job with cron expression (e.g., “0 0 * * * *” for hourly)
Sourcepub fn reschedule(&mut self)
pub fn reschedule(&mut self)
Reschedule recurring job for next run
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
Check if job should be retried
Sourcepub fn calculate_backoff(&self) -> Duration
pub fn calculate_backoff(&self) -> Duration
Calculate backoff duration for retry
Trait Implementations§
Source§impl Clone for JobWrapper
impl Clone for JobWrapper
Source§fn clone(&self) -> JobWrapper
fn clone(&self) -> JobWrapper
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JobWrapper
impl Debug for JobWrapper
Source§impl<'de> Deserialize<'de> for JobWrapper
impl<'de> Deserialize<'de> for JobWrapper
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JobWrapper
impl RefUnwindSafe for JobWrapper
impl Send for JobWrapper
impl Sync for JobWrapper
impl Unpin for JobWrapper
impl UnwindSafe for JobWrapper
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> 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>
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