pub struct JobRecord {Show 19 fields
pub id: Uuid,
pub job_type: String,
pub input: Value,
pub output: Option<Value>,
pub status: JobStatus,
pub priority: i32,
pub attempts: i32,
pub max_attempts: i32,
pub last_error: Option<String>,
pub worker_capability: Option<String>,
pub worker_id: Option<Uuid>,
pub idempotency_key: Option<String>,
pub scheduled_at: DateTime<Utc>,
pub created_at: DateTime<Utc>,
pub claimed_at: Option<DateTime<Utc>>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub failed_at: Option<DateTime<Utc>>,
pub last_heartbeat: Option<DateTime<Utc>>,
}Expand description
A job record in the database.
Fields§
§id: UuidUnique job ID.
job_type: StringJob type/name.
input: ValueJob input as JSON.
output: Option<Value>Job output as JSON (if completed).
status: JobStatusCurrent status.
priority: i32Priority level.
attempts: i32Number of attempts made.
max_attempts: i32Maximum attempts allowed.
last_error: Option<String>Last error message.
worker_capability: Option<String>Required worker capability.
worker_id: Option<Uuid>Worker ID that claimed the job.
idempotency_key: Option<String>Idempotency key for deduplication.
scheduled_at: DateTime<Utc>When the job is scheduled to run.
created_at: DateTime<Utc>When the job was created.
claimed_at: Option<DateTime<Utc>>When the job was claimed.
started_at: Option<DateTime<Utc>>When the job started running.
completed_at: Option<DateTime<Utc>>When the job completed.
failed_at: Option<DateTime<Utc>>When the job failed.
last_heartbeat: Option<DateTime<Utc>>Last heartbeat time.
Implementations§
Source§impl JobRecord
impl JobRecord
Sourcepub fn new(
job_type: impl Into<String>,
input: Value,
priority: JobPriority,
max_attempts: i32,
) -> Self
pub fn new( job_type: impl Into<String>, input: Value, priority: JobPriority, max_attempts: i32, ) -> Self
Create a new job record.
Sourcepub fn with_capability(self, capability: impl Into<String>) -> Self
pub fn with_capability(self, capability: impl Into<String>) -> Self
Set worker capability requirement.
Sourcepub fn with_scheduled_at(self, at: DateTime<Utc>) -> Self
pub fn with_scheduled_at(self, at: DateTime<Utc>) -> Self
Set scheduled time.
Sourcepub fn with_idempotency_key(self, key: impl Into<String>) -> Self
pub fn with_idempotency_key(self, key: impl Into<String>) -> Self
Set idempotency key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobRecord
impl RefUnwindSafe for JobRecord
impl Send for JobRecord
impl Sync for JobRecord
impl Unpin for JobRecord
impl UnwindSafe for JobRecord
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