pub struct SqliteJobStore { /* private fields */ }Expand description
SQLite-backed job store implementing every job port.
Implementations§
Source§impl SqliteJobStore
impl SqliteJobStore
pub const fn new(pool: SqlitePool) -> Self
Sourcepub async fn enqueue_in(
&self,
transaction: &mut Transaction<'_, Sqlite>,
record: JobRecord,
) -> Result<EnqueueOutcome, JobError>
pub async fn enqueue_in( &self, transaction: &mut Transaction<'_, Sqlite>, record: JobRecord, ) -> Result<EnqueueOutcome, JobError>
Insert the job and its first publication generation inside the caller’s transaction so the business mutation and the durable dispatch commit atomically.
Sourcepub async fn ingest_in(
&self,
transaction: &mut Transaction<'_, Sqlite>,
record: JobRecord,
) -> Result<IngestOutcome, JobError>
pub async fn ingest_in( &self, transaction: &mut Transaction<'_, Sqlite>, record: JobRecord, ) -> Result<IngestOutcome, JobError>
Insert the job with its publication recorded as already delivered (Scheduler ingestion) inside the caller’s transaction.
Trait Implementations§
Source§impl Clone for SqliteJobStore
impl Clone for SqliteJobStore
Source§fn clone(&self) -> SqliteJobStore
fn clone(&self) -> SqliteJobStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqliteJobStore
impl Debug for SqliteJobStore
Source§impl JobPublicationStore for SqliteJobStore
impl JobPublicationStore for SqliteJobStore
Source§fn claim_due<'life0, 'life1, 'async_trait>(
&'life0 self,
worker_execution_id: &'life1 str,
limit: usize,
claim_expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JobPublication>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn claim_due<'life0, 'life1, 'async_trait>(
&'life0 self,
worker_execution_id: &'life1 str,
limit: usize,
claim_expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JobPublication>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically claim up to
limit due publications. The returned
publications carry the claim’s lease identity.Source§fn mark_published<'life0, 'async_trait>(
&'life0 self,
publication_id: Uuid,
lease_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_published<'life0, 'async_trait>(
&'life0 self,
publication_id: Uuid,
lease_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark one publication delivered, fenced by its lease.
Source§fn mark_failed<'life0, 'life1, 'async_trait>(
&'life0 self,
publication_id: Uuid,
lease_id: Uuid,
error: &'life1 str,
retry_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_failed<'life0, 'life1, 'async_trait>(
&'life0 self,
publication_id: Uuid,
lease_id: Uuid,
error: &'life1 str,
retry_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record a failed transport send with a retry time, fenced by the
publication lease.
Source§impl JobStore for SqliteJobStore
impl JobStore for SqliteJobStore
Source§fn enqueue_with_intent<'life0, 'async_trait>(
&'life0 self,
record: JobRecord,
) -> Pin<Box<dyn Future<Output = Result<EnqueueOutcome, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn enqueue_with_intent<'life0, 'async_trait>(
&'life0 self,
record: JobRecord,
) -> Pin<Box<dyn Future<Output = Result<EnqueueOutcome, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically insert the job and its first pending publication
generation. SQL adapters additionally expose
enqueue_in to share
the caller’s transaction.Source§fn ingest_existing_delivery<'life0, 'async_trait>(
&'life0 self,
record: JobRecord,
) -> Pin<Box<dyn Future<Output = Result<IngestOutcome, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ingest_existing_delivery<'life0, 'async_trait>(
&'life0 self,
record: JobRecord,
) -> Pin<Box<dyn Future<Output = Result<IngestOutcome, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically ingest a delivery that already exists on the transport
(Scheduler occurrences): create the job with its publication marked
delivered, or locate the existing occurrence, without ever inserting
a pending publication.
Source§fn claim_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_execution_id: &'life1 str,
lease_expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<JobClaim>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn claim_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_execution_id: &'life1 str,
lease_expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<JobClaim>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically claim the execution lease for one delivery. The
worker_execution_id must be unique per invocation (not a static
worker name); the returned claim’s opaque lease_id is the sole
mutation authority. Returns None when the job is missing, already
leased, not yet available or terminal.Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record terminal success and release the lease, fenced by the claim.
Source§fn schedule_retry_and_publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
failure_code: &'life2 str,
next_available_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn schedule_retry_and_publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
failure_code: &'life2 str,
next_available_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Atomically record a retryable failure: verify the claim fence,
append the attempt, return the job to
pending at the next
availability time, clear the execution lease and insert the next
pending publication generation — all in one transaction, so no
intermediate committed state can strand the job.Source§fn fail_permanently<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
failure_code: &'life2 str,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fail_permanently<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
claim: &'life1 JobClaim,
failure_code: &'life2 str,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record terminal failure and release the lease, fenced by the claim.
Source§fn cancel<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
expected_revision: u64,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
expected_revision: u64,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Operator-guarded cancellation of a non-running job.
Source§fn retry_failed<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
expected_revision: u64,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<DateTime<Utc>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn retry_failed<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
expected_revision: u64,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<DateTime<Utc>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Operator-guarded retry of a permanently failed job: back to
pending at a fresh revision with a new pending publication
generation, atomically.Source§fn recover_expired_leases<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<usize, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recover_expired_leases<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<usize, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reset expired
running leases back to pending and open a pending
publication generation for each recovered job. Returns the number
recovered.fn get<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<JobRecord>, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl OverlapLockStore for SqliteJobStore
impl OverlapLockStore for SqliteJobStore
Source§fn acquire<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acquire<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acquire the lock for
lease_id until expires_at; false when held.Source§fn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
expires_at: DateTime<Utc>,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<bool, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extend a held lock; false when the caller no longer owns it.
Source§fn release<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release<'life0, 'life1, 'async_trait>(
&'life0 self,
overlap_key: &'life1 str,
lease_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Release a held lock. Releasing an unheld lock is a no-op; releasing
another owner’s lock is impossible by construction.
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteJobStore
impl !UnwindSafe for SqliteJobStore
impl Freeze for SqliteJobStore
impl Send for SqliteJobStore
impl Sync for SqliteJobStore
impl Unpin for SqliteJobStore
impl UnsafeUnpin for SqliteJobStore
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