Struct RunningJobData

Source
pub struct RunningJobData {
    pub id: Uuid,
    pub name: Option<String>,
    pub worker_id: u64,
    pub heartbeat_increment: i32,
    pub job_type: String,
    pub priority: i32,
    pub weight: u16,
    pub payload: Vec<u8>,
    pub expires: AtomicI64,
    pub start_time: OffsetDateTime,
    pub current_try: i32,
    pub max_retries: i32,
    /* private fields */
}
Expand description

Information about a running job. This is usually accessed through the RunningJob type, which wraps this in an Arc.

Fields§

§id: Uuid

The id of this job.

§name: Option<String>

The name given to this job

§worker_id: u64

The ID of the Worker that is running this job.

§heartbeat_increment: i32

How many seconds a heartbeat can extend the expiration time.

§job_type: String

The type of the job.

§priority: i32

The job’s priority.

§weight: u16

How much this job counts against the worker’s concurrency limit.

§payload: Vec<u8>

The payload of the job. JSON payloads can be parsed using the RunningJobData::json_payload function.

§expires: AtomicI64

The timestamp, in seconds, when this job expires.

§start_time: OffsetDateTime

When the job was started.

§current_try: i32

How many times this job has been tried already. On the first run, this will be 0.

§max_retries: i32

The number of times this job can be retried before giving up permanently.

Implementations§

Source§

impl RunningJobData

Source

pub async fn checkpoint_blob( &self, new_payload: Vec<u8>, ) -> Result<OffsetDateTime>

Checkpoint the task, replacing the payload with the passed in value.

Source

pub async fn checkpoint_json<T: Serialize>( &self, new_payload: T, ) -> Result<OffsetDateTime>

Checkpoint the task, replacing the payload with the passed in value.

Source

pub async fn heartbeat(&self) -> Result<OffsetDateTime>

Tell the queue that the task is still running.

Source

pub fn is_expired(&self) -> bool

Return if the task is past the expiration time or not.

Source

pub fn json_payload<'a, T: Deserialize<'a>>(&'a self) -> Result<T>

Deserialize a JSON payload into the requested type.

Source

pub async fn complete<T: Serialize + Send + Debug>( &self, info: T, ) -> Result<(), Error>

Mark the job as successful.

Source

pub async fn fail<T: Serialize + Send + Debug>( &self, info: T, ) -> Result<(), Error>

Mark the job as failed.

Trait Implementations§

Source§

impl Debug for RunningJobData

Source§

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

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

impl Display for RunningJobData

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<T> ErasedDestructor for T
where T: 'static,