Skip to main content

ProcessingJob

Struct ProcessingJob 

Source
pub struct ProcessingJob {
    pub id: Uuid,
    pub file_id: Uuid,
    pub job_type: ProcessingJobType,
    pub priority: i32,
    pub input_data: Option<Value>,
    pub result_data: Option<Value>,
    pub error_message: Option<String>,
    pub started_at: Option<DateTime<Utc>>,
    pub completed_at: Option<DateTime<Utc>>,
    pub retry_count: i32,
    pub max_retries: i32,
    pub metadata: AuditMetadata,
    /* private fields */
}

Fields§

§id: Uuid§file_id: Uuid§job_type: ProcessingJobType§priority: i32§input_data: Option<Value>§result_data: Option<Value>§error_message: Option<String>§started_at: Option<DateTime<Utc>>§completed_at: Option<DateTime<Utc>>§retry_count: i32§max_retries: i32§metadata: AuditMetadata

Implementations§

Source§

impl ProcessingJob

Source

pub fn builder() -> ProcessingJobBuilder

Create a builder for ProcessingJob

Source

pub fn new( file_id: Uuid, job_type: ProcessingJobType, status: JobStatus, priority: i32, retry_count: i32, max_retries: i32, ) -> Self

Create a new ProcessingJob with required fields

Source

pub fn id(&self) -> &Uuid

Get the entity’s unique identifier

Source

pub fn typed_id(&self) -> ProcessingJobId

Get a strongly-typed ID for this entity

Source

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

Get when this entity was created

Source

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

Get when this entity was last updated

Source

pub fn is_deleted(&self) -> bool

Check if this entity is soft deleted

Source

pub fn is_active(&self) -> bool

Check if this entity is active (not deleted)

Source

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

Get when this entity was deleted

Source

pub fn created_by(&self) -> Option<&Uuid>

Get who created this entity

Source

pub fn updated_by(&self) -> Option<&Uuid>

Get who last updated this entity

Source

pub fn deleted_by(&self) -> Option<&Uuid>

Get who deleted this entity

Source

pub fn status(&self) -> &JobStatus

Get the current status

Source

pub fn with_input_data(self, value: Value) -> Self

Set the input_data field (chainable)

Source

pub fn with_result_data(self, value: Value) -> Self

Set the result_data field (chainable)

Source

pub fn with_error_message(self, value: String) -> Self

Set the error_message field (chainable)

Source

pub fn with_started_at(self, value: DateTime<Utc>) -> Self

Set the started_at field (chainable)

Source

pub fn with_completed_at(self, value: DateTime<Utc>) -> Self

Set the completed_at field (chainable)

Source

pub fn transition_to( &mut self, new_state: ProcessingJobState, ) -> Result<(), StateMachineError>

Transition to a new state via the status state machine.

Returns Err if the transition is not permitted from the current state. Use this method instead of assigning self.status directly.

Source

pub fn apply_patch(&mut self, fields: HashMap<String, Value>)

Apply partial updates from a map of field name to JSON value

Source

pub fn can_retry(&self) -> bool

Check if job can be retried (failed and retries remaining)

Source

pub fn increment_retry(&mut self)

Increment retry count

Source

pub fn mark_started(&mut self) -> Result<(), JobError>

Mark job as started

Source

pub fn mark_completed(&mut self, result: Value) -> Result<(), JobError>

Mark job as completed with result

Source

pub fn mark_failed(&mut self, error: String) -> Result<(), JobError>

Mark job as failed with error

Source

pub fn cancel(&mut self) -> Result<(), JobError>

Cancel the job

Source

pub fn duration(&self) -> Option<Duration>

Get job execution duration (completed_at - started_at if both present)

Source

pub fn check_invariants(&self) -> Result<(), Vec<&'static str>>

Check all business invariants

Trait Implementations§

Source§

impl ApplyUpdateDto<UpdateProcessingJobDto> for ProcessingJob

Source§

impl Clone for ProcessingJob

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 CrudRepository<ProcessingJob> for ProcessingJobRepository

Hydrate ?include= relations: fetch rows from table by id list, as JSON (raw row_to_json). table comes from EntityRepoMeta::relations() (generator-emitted), never client input. Default: no expansion. The Postgres-backed generated repos override this via impl_crud_repository!.
Source§

fn create<'life0, 'async_trait>( &'life0 self, entity: ProcessingJob, ) -> Pin<Box<dyn Future<Output = Result<ProcessingJob, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new entity
Source§

fn find_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find entity by ID (excluding soft-deleted)
Source§

fn find_by_id_including_deleted<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find entity by ID (including soft-deleted, for trash operations)
Source§

fn update<'life0, 'async_trait>( &'life0 self, entity: ProcessingJob, ) -> Pin<Box<dyn Future<Output = Result<ProcessingJob, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update an existing entity
Source§

fn soft_delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft delete an entity
Source§

fn restore<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore a soft-deleted entity
Source§

fn hard_delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently delete an entity
Source§

fn list<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(Vec<ProcessingJob>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List entities with pagination (excluding soft-deleted)
Source§

fn list_filtered<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<ProcessingJob>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List entities with pagination and filters (excluding soft-deleted) Read more
Source§

fn list_filtered_with_info<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<ProcessingJob>, PaginationInfo), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

list_filtered, carrying the pagination info (cursor positions included) so the HTTP layer can surface keyset paging. Default: the tuple form with the cursor fields absent; the generated Postgres repositories override this with the real keyset walk.
Source§

fn table_name(&self) -> Option<&str>

Group and reduce entities under the same filters as list_filtered. Read more
Source§

fn aggregate_filtered<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 AggregateSpec, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<AggregateResult, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn list_deleted<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(Vec<ProcessingJob>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List soft-deleted entities with pagination
Source§

fn count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count all entities (excluding soft-deleted)
Source§

fn count_deleted<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count soft-deleted entities
Source§

fn bulk_create<'life0, 'async_trait>( &'life0 self, entities: Vec<ProcessingJob>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Bulk create entities
Source§

fn empty_trash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Permanently delete all soft-deleted entities
Source§

fn bulk_soft_delete<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-delete many entities by id. Returns the number affected.
Source§

fn bulk_restore<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore many soft-deleted entities by id. Returns the restored entities.
Source§

fn bulk_hard_delete<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently delete many entities by id. Returns the number affected.
Source§

fn restore_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Restore every soft-deleted entity. Returns the restored entities.
Source§

fn bulk_update<'life0, 'async_trait>( &'life0 self, entities: Vec<ProcessingJob>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcessingJob>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update many entities atomically. Returns the updated entities.
Source§

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if an entity exists by ID
Source§

impl Debug for ProcessingJob

Source§

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

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

impl<'de> Deserialize<'de> for ProcessingJob

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 DomainPolicy<ProcessingJob> for ProcessingJobDomainPolicy

Source§

fn can_create<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can a new entity in the given state be persisted?
Source§

fn can_update<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _current: &'life1 E, _updated: &'life2 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Can the entity transition from current to updated state?
Source§

fn can_delete<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can the entity be soft-deleted?
Source§

fn can_restore<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can a soft-deleted entity be restored?
Source§

fn enforce_create<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Convenience: enforce can_create and map to Ok(()) or Err(reason).
Source§

fn enforce_delete<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Convenience: enforce can_delete and map to Ok(()) or Err(reason).
Source§

impl Entity for ProcessingJob

Source§

type Id = Uuid

The type of the entity’s unique identifier
Source§

fn entity_id(&self) -> &Self::Id

Get the entity’s unique identifier
Source§

fn entity_type() -> &'static str

Get the entity type name
Source§

impl EntityRepoMeta for ProcessingJob

Source§

fn column_types() -> HashMap<String, String>

PostgreSQL type hints for filter/sort (e.g. {"id": "uuid"}).
Source§

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

Text columns to include in full-text / ILIKE search.
Source§

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

Response fields visible only to the row owner and platform/root callers (@private). Stripped for everyone else.
Source§

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

Response fields (camelCase) that never leave the server (@sensitive): no caller is served them, a platform caller or the row’s owner included.
Source§

fn relation_secret_fields(_relation: &str) -> &'static [&'static str]

The @sensitive fields (camelCase response keys) of the model a to-one relation points at, stripped from the related row an ?include= expands. Keyed by the relation name of relations. Default: none.
Source§

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

The response field (camelCase) holding the owner/company id (@owner), compared against the caller’s access scope to decide private-field visibility. None = the entity has no owner concept.
Source§

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

The DB column that scopes rows to a company (snake_case, e.g. company_id). None = the entity is global (reference data) and is not fenced. Read more
Source§

fn relations() -> &'static [(&'static str, &'static str, &'static str)]

To-one relations expandable via ?include=<name>, as (relation_name, target_table, local_fk_field) — all response keys (relation_name/local_fk in camelCase; target_table is the DB table). Default: none.
Source§

impl From<&ProcessingJob> for ProcessingJobResponseDto

Source§

fn from(entity: &ProcessingJob) -> Self

Converts to this type from the input type.
Source§

impl From<CreateProcessingJobDto> for ProcessingJob

Source§

fn from(dto: CreateProcessingJobDto) -> Self

Converts to this type from the input type.
Source§

impl From<ProcessingJob> for ProcessingJobResponseDto

Source§

fn from(entity: ProcessingJob) -> Self

Converts to this type from the input type.
Source§

impl From<ProcessingJob> for ProcessingJobSummaryDto

Source§

fn from(entity: ProcessingJob) -> Self

Converts to this type from the input type.
Source§

impl FromCreateDto<CreateProcessingJobDto> for ProcessingJob

Source§

impl<'a, R: Row> FromRow<'a, R> for ProcessingJob

Source§

fn from_row(__row: &'a R) -> Result<Self>

Source§

impl HasComputedFields for ProcessingJob

Computed fields for ProcessingJob entity

Source§

fn computed_fields(&self) -> ComputedFieldValues

Get all computed field values
Source§

fn computed_field(&self, name: &str) -> Option<Value>

Get a specific computed field value
Source§

impl PersistentEntity for ProcessingJob

Source§

fn entity_id(&self) -> String

Get the entity’s unique identifier
Source§

fn set_entity_id(&mut self, id: String)

Set the entity’s unique identifier
Source§

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

Get creation timestamp
Source§

fn set_created_at(&mut self, ts: DateTime<Utc>)

Set creation timestamp
Source§

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

Get last update timestamp
Source§

fn set_updated_at(&mut self, ts: DateTime<Utc>)

Set last update timestamp
Source§

fn deleted_at(&self) -> Option<DateTime<Utc>>

Get soft delete timestamp (None if not deleted)
Source§

fn set_deleted_at(&mut self, ts: Option<DateTime<Utc>>)

Set soft delete timestamp
Source§

fn is_deleted(&self) -> bool

Check if entity is soft-deleted
Source§

fn mark_deleted(&mut self)

Mark entity as deleted (soft delete)
Source§

fn restore(&mut self)

Restore a soft-deleted entity
Source§

fn touch(&mut self)

Touch the entity (update timestamp)
Source§

fn generate_id() -> String

Generate a new ID for this entity type
Source§

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

Fields that a generic write (PUT, PATCH and their bulk forms) may not change, by their serialized name. Read more
Source§

impl Serialize for ProcessingJob

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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