pub struct JobRepository { /* private fields */ }Expand description
PostgreSQL implementation of the job queue.
Uses SELECT FOR UPDATE SKIP LOCKED for safe concurrent job claiming,
ensuring that multiple workers can process jobs without conflicts.
Implementations§
Trait Implementations§
Source§impl Clone for JobRepository
impl Clone for JobRepository
Source§fn clone(&self) -> JobRepository
fn clone(&self) -> JobRepository
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl JobQueue for JobRepository
impl JobQueue for JobRepository
Source§async fn create_job(
&self,
request: CreateJobRequest,
) -> Result<HarvestJob, AppError>
async fn create_job( &self, request: CreateJobRequest, ) -> Result<HarvestJob, AppError>
Create a new job in the queue. Read more
Source§async fn claim_job(
&self,
worker_id: &str,
) -> Result<Option<HarvestJob>, AppError>
async fn claim_job( &self, worker_id: &str, ) -> Result<Option<HarvestJob>, AppError>
Claim the next available pending job for processing. Read more
Source§async fn complete_job(
&self,
job_id: Uuid,
stats: SyncStats,
) -> Result<(), AppError>
async fn complete_job( &self, job_id: Uuid, stats: SyncStats, ) -> Result<(), AppError>
Mark a job as completed with final statistics.
Source§async fn fail_job(
&self,
job_id: Uuid,
error: &str,
next_retry_at: Option<DateTime<Utc>>,
) -> Result<(), AppError>
async fn fail_job( &self, job_id: Uuid, error: &str, next_retry_at: Option<DateTime<Utc>>, ) -> Result<(), AppError>
Mark a job as failed with error message. Read more
Source§async fn cancel_job(
&self,
job_id: Uuid,
stats: Option<SyncStats>,
) -> Result<(), AppError>
async fn cancel_job( &self, job_id: Uuid, stats: Option<SyncStats>, ) -> Result<(), AppError>
Mark a job as cancelled. Read more
Source§async fn get_job(&self, job_id: Uuid) -> Result<Option<HarvestJob>, AppError>
async fn get_job(&self, job_id: Uuid) -> Result<Option<HarvestJob>, AppError>
Get a job by ID.
Source§async fn list_jobs(
&self,
status: Option<JobStatus>,
limit: usize,
) -> Result<Vec<HarvestJob>, AppError>
async fn list_jobs( &self, status: Option<JobStatus>, limit: usize, ) -> Result<Vec<HarvestJob>, AppError>
List jobs with optional status filter. Read more
Source§async fn release_job(&self, job_id: Uuid) -> Result<(), AppError>
async fn release_job(&self, job_id: Uuid) -> Result<(), AppError>
Release a job back to pending state. Read more
Auto Trait Implementations§
impl Freeze for JobRepository
impl !RefUnwindSafe for JobRepository
impl Send for JobRepository
impl Sync for JobRepository
impl Unpin for JobRepository
impl !UnwindSafe for JobRepository
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