Skip to main content

FailedJob

Struct FailedJob 

Source
pub struct FailedJob {
    pub id: String,
    pub queue: String,
    pub job_type: String,
    pub payload: Value,
    pub options: JobOptions,
    pub error: String,
    pub attempts: u32,
    pub failed_at: DateTime<Utc>,
}
Expand description

A job that used up its attempts (or could not run at all), as kept in failed_jobs until it is retried or flushed.

It is also the navree-orm model of the database driver’s failed_jobs table (FAILED_JOBS_TABLE), which the driver writes and reads through the ORM: the payload and options are stored as JSON text, the failure time as Unix milliseconds, and code queries them with typed columns (FailedJob::query().where_(FailedJob::QUEUE.eq("mail"))). Other drivers keep failed jobs their own way.

Fields§

§id: String

The job id (the id dispatch returned).

§queue: String

The queue it was on.

§job_type: String

The job type (Job::NAME).

§payload: Value

The job value as JSON.

§options: JobOptions

The options it was dispatched with.

§error: String

The error of the last attempt.

§attempts: u32

How many attempts ran.

§failed_at: DateTime<Utc>

When it failed.

Implementations§

Source§

impl FailedJob

Source

pub const ID: Column<Self, String>

The id column (failed_jobs.id).

Source

pub const QUEUE: Column<Self, String>

The queue column (failed_jobs.queue).

Source

pub const JOB_TYPE: Column<Self, String>

The job_type column (failed_jobs.job_type).

Source

pub const PAYLOAD: Column<Self, Value>

The payload column (failed_jobs.payload).

Source

pub const OPTIONS: Column<Self, JobOptions>

The options column (failed_jobs.options).

Source

pub const ERROR: Column<Self, String>

The error column (failed_jobs.error).

Source

pub const ATTEMPTS: Column<Self, u32>

The attempts column (failed_jobs.attempts).

Source

pub const FAILED_AT: Column<Self, DateTime<Utc>>

The failed_at column (failed_jobs.failed_at).

Source§

impl FailedJob

Source

pub fn requeued(&self, now: i64) -> NewJob

The job as it goes back on its queue at now (Unix milliseconds): same id, attempts start over, not unique.

Trait Implementations§

Source§

impl Clone for FailedJob

Source§

fn clone(&self) -> Self

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 FailedJob

Source§

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

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

impl<'de> Deserialize<'de> for FailedJob

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&FailedJob> for FailedJobBrief

Source§

fn from(job: &FailedJob) -> FailedJobBrief

Converts to this type from the input type.
Source§

impl Model for FailedJob

Source§

type Key = String

The key’s Rust type.
Source§

fn meta() -> &'static ModelMeta

What the derive knows about the model.
Source§

fn key(&self) -> Self::Key

The key.
Source§

fn set_key(&mut self, key: Self::Key)

Sets the key.
Source§

fn from_row(row: &Row) -> Result<Self>

Reads a model from a row.
Source§

fn values(&self) -> Result<Vec<(&'static str, Value)>>

Every column and its stored value, in field order.
Source§

fn value(&self, column: &str) -> Result<Option<Value>>

The stored value of column; None when the model has no such column.
Source§

fn set_value(&mut self, column: &str, value: Value) -> Result<()>

Sets column from a stored value.
Source§

fn touch_timestamp(&mut self, column: &str, now: DateTime<Utc>) -> Result<()>

Sets timestamp column column to now.
Source§

fn timestamp_is_empty(&self, column: &str) -> bool

Whether timestamp column column is unset.
Source§

fn clear_timestamp(&mut self, column: &str)

Unsets timestamp column column.
Source§

fn timestamp_value(column: &str, now: DateTime<Utc>) -> Option<Value>

The stored value of timestamp column column at now.
Source§

fn relation(name: &str) -> Option<DynRelation<Self>>

The relation named name, for relation paths ("company.owner" in with, has, load, …): the ones a #[relations] impl block declares, then the ones other modules define with RelationRegistry. #[derive(Model)] writes this method.
Source§

fn relation_names() -> Vec<Cow<'static, str>>

The names of the model’s relations (declared, then registered).
Source§

fn set_attribute(&mut self, column: &str, input: Value) -> Result<()>

Sets column from untyped input, the way mass assignment does: the value is converted to the field’s type (through its cast’s from_json), then assigned through the field’s mutator (#[model(set_with = ..)]) when it has one. Unknown columns are errors. Read more
Source§

fn changed_columns(&self, original: &Self) -> Result<Vec<&'static str>>

The columns whose values differ between self and original (dirty tracking), compared as stored: floats within a small tolerance, decimals numerically, date-times by instant, JSON structurally, cast fields by their cast’s same.
Source§

fn json_attribute(&self, column: &str) -> Result<Option<Value>>

The JSON value of JSON column column (a serde_json::Value field or a JSON cast), for edits by path; None when the model has no such JSON column.
Source§

fn accessors() -> &'static [Accessor<Self>]

The accessors of the model (#[accessor] methods in an #[accessors] impl block), which serialized records can append.
Source§

fn global_scopes() -> Vec<Arc<dyn GlobalScope<Self>>>

The global scopes applied to every query of the model (#[model(global_scopes(..))]).
Source§

fn hooks() -> Vec<Arc<dyn ModelHook<Self>>>

The model’s own lifecycle hooks, run before the app’s (see hooks).
Source§

fn fillable() -> &'static [&'static str]

The columns fill may set, as declared (#[model(fillable(..))]).
Source§

fn guarded() -> Option<&'static [&'static str]>

The columns fill may not set, as declared (#[model(guarded(..))]); None when the model declares none (every column not fillable is guarded).
Source§

fn is_fillable(column: &str) -> bool

Whether fill may set column (or the JSON path column->path).
Source§

fn is_guarded(column: &str) -> bool

Whether column is guarded against mass assignment.
Source§

fn totally_guarded() -> bool

Whether the model declares neither fillable nor guarded columns, so every fill is refused (force_fill still works).
Source§

fn relation_meta(name: &str) -> Option<RelationMeta>

What relation name is: its kind, related model, tables and keys (for tooling such as model:show and API documentation). Read more
Source§

fn morph_name() -> Cow<'static, str>

The name polymorphic type columns store for the model (#[model(morph_name = "...")], else the snake_case type name).
Source§

fn foreign_key_name() -> Cow<'static, str>

The default name of foreign keys to the model (company_id): the snake_case type name, _, the key column.
Source§

fn touched_relations() -> &'static [&'static str]

The relations touched when a record is saved or deleted (#[model(touches = [..])]).
Source§

fn table_name() -> &'static str

The model’s table. Read more
Source§

fn route_key_name() -> &'static str

The column route model binding looks records up by: the model’s #[model(route_key = "...")], else its key column. Read more
Source§

fn query() -> Builder<Self>

A query of the model, with the model’s default eager loads and relation counts (#[model(with = [..], with_count = [..])]).
Source§

fn where_(filter: impl Into<Filter>) -> Builder<Self>

A query of the model with one condition (and the model’s default eager loads and relation counts, as query).
Source§

fn connection_name() -> Option<&'static str>

The connection the model lives on (#[model(connection = "..")]); None runs it on the executor’s. Given the default Db, the model’s queries and records go to this connection.
Source§

fn on_connection(name: impl Into<Cow<'static, str>>) -> Builder<Self>

A query of the model on connection name, whatever the model’s (see Builder::on_connection).
Source§

fn on_write_connection() -> Builder<Self>

A query of the model reading from the writer, even where read replicas exist (see Builder::use_write). Read more
Source§

fn all<E>( exec: &E, ) -> impl Future<Output = Result<Collection<Self>, OrmError>> + Send
where E: Executor + ?Sized,

Every record.
Source§

fn find<E>( exec: &E, key: impl Into<Self::Key>, ) -> impl Future<Output = Result<Option<Record<Self>>, OrmError>> + Send
where E: Executor + ?Sized,

The record with key key.
Source§

fn find_or_fail<E>( exec: &E, key: impl Into<Self::Key>, ) -> impl Future<Output = Result<Record<Self>, OrmError>> + Send
where E: Executor + ?Sized,

The record with key key, or OrmError::ModelNotFound (a 404 over HTTP).
Source§

fn find_many<E>( exec: &E, keys: impl IntoIterator<Item = impl Into<Self::Key>>, ) -> impl Future<Output = Result<Collection<Self>, OrmError>> + Send
where E: Executor + ?Sized,

The records with these keys (missing ones are left out).
Source§

fn create<E>( exec: &E, model: Self, ) -> impl Future<Output = Result<Record<Self>, OrmError>> + Send
where E: Executor + ?Sized,

Inserts model and returns its record (with any generated key and timestamps).
Source§

fn insert<E>( exec: &E, models: impl IntoIterator<Item = Self>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized,

Inserts models as they are, in one statement without hooks or change events (see Builder::insert); returns how many rows were inserted.
Source§

fn insert_or_ignore<E>( exec: &E, models: impl IntoIterator<Item = Self>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized,

Inserts models as they are, skipping the ones that conflict with a unique index (see Builder::insert_or_ignore).
Source§

fn fill_and_insert<E>( exec: &E, models: impl IntoIterator<Item = Self>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized,

Inserts models with generated keys and timestamps, in one statement without hooks (see Builder::fill_and_insert).
Source§

fn upsert<E, U>( exec: &E, models: impl IntoIterator<Item = Self>, unique_by: impl IntoIterator<Item = impl ColumnName>, update: impl IntoIterator<Item = U>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized, U: Into<ConflictUpdate>,

Inserts models, updating the stored rows they conflict with on unique_by (see Builder::upsert).
Source§

fn destroy<E>( exec: &E, keys: impl IntoIterator<Item = impl Into<Self::Key>>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized,

Deletes the records with these keys one by one (so each one’s lifecycle runs); returns how many were deleted.
Source§

impl PartialEq for FailedJob

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for FailedJob

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FailedJob

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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<M> ModelLifecycle for M
where M: Model,

Source§

fn create_quietly<E>( exec: &E, model: Self, ) -> impl Future<Output = Result<Record<Self>, OrmError>> + Send
where E: Executor + ?Sized,

Inserts model and returns its record without model events (Model::create inside without_events). Read more
Source§

fn force_destroy<E>( exec: &E, keys: impl IntoIterator<Item = impl Into<Self::Key>>, ) -> impl Future<Output = Result<u64, OrmError>> + Send
where E: Executor + ?Sized,

Removes the records with these keys for good, soft-deleted ones included, loading each so its force-delete events fire; returns how many were removed. On a model without soft deletes it is destroy. Read more
Source§

fn restore_or_create<E>( exec: &E, attributes: impl IntoIterator<Item = Assignment>, fill: impl FnOnce(&mut Self) + Send, ) -> impl Future<Output = Result<Record<Self>, OrmError>> + Send
where E: Executor + ?Sized, Self: SoftDeleting + Default,

The record matching attributes, soft-deleted or not, restored when it was trashed; or a new one with them (and whatever fill sets) inserted. See Builder::restore_or_create.
Source§

fn create_or_restore<E>( exec: &E, attributes: impl IntoIterator<Item = Assignment>, fill: impl FnOnce(&mut Self) + Send, ) -> impl Future<Output = Result<Record<Self>, OrmError>> + Send
where E: Executor + ?Sized, Self: SoftDeleting + Default,

Inserts a record with attributes (and whatever fill sets), or on a unique violation returns the record holding them, restored when it was trashed. See Builder::create_or_restore.
Source§

fn has_global_scope(name: &str) -> bool

Whether the model has a global scope named name (declared, registered at boot, or SoftDeletes). Read more
Source§

fn global_scope(name: &str) -> Option<Arc<dyn GlobalScope<Self>>>

The global scope named name, if the model has one.
Source§

fn global_scope_names() -> Vec<Cow<'static, str>>

The names of every global scope the model’s queries apply, in order.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<M> Relationships for M
where M: Model,

Source§

fn belongs_to<R, T>(&self, foreign_key: Column<Self, T>) -> BelongsTo<Self, R>
where R: Model,

The record of R this record’s foreign_key column points at (by R’s key unless owner_key says otherwise): a deal’s company.
Source§

fn has_one<R, T>(&self, foreign_key: Column<R, T>) -> HasOne<Self, R>
where R: Model,

The record of R whose foreign_key column holds this record’s key (or local_key): a user’s profile.
Source§

fn has_many<R, T>(&self, foreign_key: Column<R, T>) -> HasMany<Self, R>
where R: Model,

The records of R whose foreign_key column holds this record’s key: a deal’s activities.
Source§

fn belongs_to_many<R>( &self, table: impl Into<Cow<'static, str>>, ) -> BelongsToMany<Self, R>
where R: Model,

The records of R linked to this one by rows of pivot table table, whose columns {self}_id and {related}_id hold the two keys (see BelongsToMany for other names). The conventional table is both models’ snake_case names in alphabetical order, joined by _ (deal_tag).
Source§

fn has_one_through<R, T, A, B>( &self, first_key: Column<T, A>, second_key: Column<R, B>, ) -> HasOneThrough<Self, R>
where R: Model, T: Model,

The record of R reached through model T: T’s first_key holds this record’s key, and R’s second_key holds T’s key (a supplier’s account history through its user).
Source§

fn has_many_through<R, T, A, B>( &self, first_key: Column<T, A>, second_key: Column<R, B>, ) -> HasManyThrough<Self, R>
where R: Model, T: Model,

The records of R reached through model T: a country’s posts through its users.
Source§

fn morph_one<R>(&self, name: &str) -> HasOne<Self, R>
where R: Model,

The record of R whose {name}_type and {name}_id columns hold this record’s morph name and key: a deal’s image.
Source§

fn morph_many<R>(&self, name: &str) -> HasMany<Self, R>
where R: Model,

The records of R whose {name}_type and {name}_id columns hold this record’s morph name and key: a deal’s comments.
Source§

fn morph_to(&self, name: &str) -> MorphTo<Self>

The record of any model this record’s {name}_type and {name}_id columns point at: a comment’s commentable.
Source§

fn morph_to_many<R>( &self, name: &str, table: impl Into<Cow<'static, str>>, ) -> BelongsToMany<Self, R>
where R: Model,

The records of R linked to this one by rows of polymorphic pivot table table (taggables: tag_id, taggable_id, taggable_type), name being the polymorphic name (taggable).
Source§

fn morphed_by_many<R>( &self, name: &str, table: impl Into<Cow<'static, str>>, ) -> BelongsToMany<Self, R>
where R: Model,

The inverse of morph_to_many: the records of R that tagged this record (a tag’s deals).
Source§

fn through<L>(&self, local: impl Fn(&Self) -> L) -> PendingThrough<Self, L>

A through relation composed of two relations: self.through( Deal::company).has(Company::contacts) reaches a deal’s contacts through its company.
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> ValueFor<Option<T>> for T

Source§

fn into_value_for(self) -> Option<T>

The value as the column’s type.
Source§

impl<T> ValueFor<T> for T

Source§

fn into_value_for(self) -> T

The value as the column’s type.
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