Skip to main content

DbJob

Struct DbJob 

Source
pub struct DbJob { /* private fields */ }
Expand description

DbJob represents a job as stored in the database.

It contains all the fields from the database table but doesn’t include the task identifier string, which is provided separately when constructing a Job instance for use in the worker system.

Implementations§

Source§

impl DbJob

Source

pub fn id(&self) -> &i64

Unique identifier for this job

Source

pub fn job_queue_id(&self) -> &Option<i32>

Foreign key to job_queues table if this job is part of a queue

Source

pub fn payload(&self) -> &Value

The JSON payload/data associated with this job

Source

pub fn priority(&self) -> &i16

Priority level (lower number means higher priority)

Source

pub fn run_at(&self) -> &DateTime<Utc>

When the job is scheduled to run

Source

pub fn attempts(&self) -> &i16

How many times this job has been attempted Attempts started, including the current execution (1 on its first run).

Source

pub fn max_attempts(&self) -> &i16

Maximum number of retry attempts before considering the job permanently failed

Source

pub fn last_error(&self) -> &Option<String>

Error message from the last failed attempt

Source

pub fn created_at(&self) -> &DateTime<Utc>

When the job was created

Source

pub fn updated_at(&self) -> &DateTime<Utc>

When the job was last updated

Source

pub fn key(&self) -> &Option<String>

Optional unique key for identifying/updating this job from user code

Source

pub fn revision(&self) -> &i32

Counter tracking the number of revisions/updates to this job

Source

pub fn locked_at(&self) -> &Option<DateTime<Utc>>

When the job was locked for processing

Source

pub fn locked_by(&self) -> &Option<String>

Worker ID that has locked this job

Source

pub fn flags(&self) -> &Option<Value>

Optional JSON flags to control job processing behavior

Source

pub fn task_id(&self) -> &i32

Foreign key to the tasks table identifying the task type

Source§

impl DbJob

Source

pub fn from_data(data: DbJobData) -> DbJob

Source

pub fn into_data(self) -> DbJobData

Source

pub fn new( id: i64, job_queue_id: Option<i32>, payload: Value, priority: i16, run_at: DateTime<Utc>, attempts: i16, max_attempts: i16, last_error: Option<String>, created_at: DateTime<Utc>, updated_at: DateTime<Utc>, key: Option<String>, revision: i32, locked_at: Option<DateTime<Utc>>, locked_by: Option<String>, flags: Option<Value>, task_id: i32, ) -> DbJob

Trait Implementations§

Source§

impl Clone for DbJob

Source§

fn clone(&self) -> DbJob

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DbJob

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for DbJob

Source§

impl From<Job> for DbJob

Conversion from Job to DbJob, dropping the task_identifier field

Source§

fn from(job: Job) -> DbJob

Converts to this type from the input type.
Source§

impl<'a, R> FromRow<'a, R> for DbJob
where R: Row, &'a str: ColumnIndex<R>, i64: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, Option<i32>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, Value: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, i16: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, i32: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>, Option<Value>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,

Source§

impl PartialEq for DbJob

Source§

fn eq(&self, other: &DbJob) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DbJob

Auto Trait Implementations§

§

impl Freeze for DbJob

§

impl RefUnwindSafe for DbJob

§

impl Send for DbJob

§

impl Sync for DbJob

§

impl Unpin for DbJob

§

impl UnsafeUnpin for DbJob

§

impl UnwindSafe for DbJob

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyClone for T
where T: Clone + Send + Sync + Debug + 'static,

Source§

fn clone_box(&self) -> Box<dyn AnyClone + Sync + Send>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more