pub struct RexecutorPgBackend { /* private fields */ }
Expand description
A postgres implementation of a rexecutor::backend::Backend
.
Implementations§
Source§impl RexecutorPgBackend
impl RexecutorPgBackend
Sourcepub async fn from_db_url(db_url: &str) -> Result<Self, BackendError>
pub async fn from_db_url(db_url: &str) -> Result<Self, BackendError>
Creates a new RexecutorPgBackend
from a db connection string.
Sourcepub async fn from_pool(pool: PgPool) -> Result<Self, BackendError>
pub async fn from_pool(pool: PgPool) -> Result<Self, BackendError>
Create a new RexecutorPgBackend
from an existing PgPool
.
Sourcepub async fn run_migrations(&self) -> Result<(), BackendError>
pub async fn run_migrations(&self) -> Result<(), BackendError>
This can be used to run the RexecutorPgBackend
’s migrations.
Trait Implementations§
Source§impl Backend for RexecutorPgBackend
impl Backend for RexecutorPgBackend
Source§fn subscribe_ready_jobs<'life0, 'async_trait>(
&'life0 self,
executor_identifier: ExecutorIdentifier,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = Result<Job, BackendError>> + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe_ready_jobs<'life0, 'async_trait>(
&'life0 self,
executor_identifier: ExecutorIdentifier,
) -> Pin<Box<dyn Future<Output = Pin<Box<dyn Stream<Item = Result<Job, BackendError>> + Send>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a stream of the jobs ready to be executed. Read more
Source§fn enqueue<'a, 'life0, 'async_trait>(
&'life0 self,
job: EnqueuableJob<'a>,
) -> Pin<Box<dyn Future<Output = Result<JobId, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn enqueue<'a, 'life0, 'async_trait>(
&'life0 self,
job: EnqueuableJob<'a>,
) -> Pin<Box<dyn Future<Output = Result<JobId, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
Enqueue a job to the backend. Read more
Source§fn mark_job_complete<'life0, 'async_trait>(
&'life0 self,
id: JobId,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_job_complete<'life0, 'async_trait>(
&'life0 self,
id: JobId,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as having been completed.
Source§fn mark_job_retryable<'life0, 'async_trait>(
&'life0 self,
id: JobId,
next_scheduled_at: DateTime<Utc>,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_job_retryable<'life0, 'async_trait>(
&'life0 self,
id: JobId,
next_scheduled_at: DateTime<Utc>,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as retryable and schedule to run it again at the given instance. Read more
Source§fn mark_job_discarded<'life0, 'async_trait>(
&'life0 self,
id: JobId,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_job_discarded<'life0, 'async_trait>(
&'life0 self,
id: JobId,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as discarded (this is the state where the job has failed to complete
successfully after reaching its max_attempts. Read more
Source§fn mark_job_cancelled<'life0, 'async_trait>(
&'life0 self,
id: JobId,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_job_cancelled<'life0, 'async_trait>(
&'life0 self,
id: JobId,
error: ExecutionError,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as cancelled. Read more
Source§fn mark_job_snoozed<'life0, 'async_trait>(
&'life0 self,
id: JobId,
next_scheduled_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_job_snoozed<'life0, 'async_trait>(
&'life0 self,
id: JobId,
next_scheduled_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as snoozed. Read more
Source§fn prune_jobs<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 PruneSpec,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prune_jobs<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 PruneSpec,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove the jobs according to the provided
PruneSpec
.Source§fn rerun_job<'life0, 'async_trait>(
&'life0 self,
id: JobId,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rerun_job<'life0, 'async_trait>(
&'life0 self,
id: JobId,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Rerun the given job. Read more
Source§impl Clone for RexecutorPgBackend
impl Clone for RexecutorPgBackend
Source§fn clone(&self) -> RexecutorPgBackend
fn clone(&self) -> RexecutorPgBackend
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for RexecutorPgBackend
impl !RefUnwindSafe for RexecutorPgBackend
impl Send for RexecutorPgBackend
impl Sync for RexecutorPgBackend
impl Unpin for RexecutorPgBackend
impl !UnwindSafe for RexecutorPgBackend
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