pub struct PostgresBackend { /* private fields */ }Expand description
PostgreSQL implementation of StorageBackend using SQLx.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Implementations§
Source§impl PostgresBackend
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());
impl PostgresBackend
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn new(pool: Pool<Postgres>) -> PostgresBackend
pub fn new(pool: Pool<Postgres>) -> PostgresBackend
Creates a new PostgresBackend from a SQLx connection pool.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn new_with_url(
pool: Pool<Postgres>,
database_url: impl Into<String>,
) -> PostgresBackend
pub fn new_with_url( pool: Pool<Postgres>, database_url: impl Into<String>, ) -> PostgresBackend
Creates a new PostgresBackend with a pool and database connection URL for dedicated LISTEN sockets.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn pool(&self) -> &Pool<Postgres>
pub fn pool(&self) -> &Pool<Postgres>
Returns reference to the underlying SQLx PgPool.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn jobs_repo(&self) -> &JobsRepo
pub fn jobs_repo(&self) -> &JobsRepo
Returns reference to the underlying JobsRepo.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn attempts_repo(&self) -> &AttemptsRepo
pub fn attempts_repo(&self) -> &AttemptsRepo
Returns reference to the underlying AttemptsRepo.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn stream_repo(&self) -> &StreamRepo
pub fn stream_repo(&self) -> &StreamRepo
Returns reference to the underlying StreamRepo.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub fn maintenance_repo(&self) -> &MaintenanceRepo
pub fn maintenance_repo(&self) -> &MaintenanceRepo
Returns reference to the underlying MaintenanceRepo.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Sourcepub async fn enqueue_in_tx(
&self,
tx: &mut Transaction<'_, Postgres>,
job: NewJob,
) -> Result<Uuid, Error>
pub async fn enqueue_in_tx( &self, tx: &mut Transaction<'_, Postgres>, job: NewJob, ) -> Result<Uuid, Error>
Inserts a job using the caller’s PostgreSQL transaction.
§Examples
use azums::PostgresBackend;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:postgres@localhost/azums")?;
let backend = PostgresBackend::new(pool);
assert!(!backend.pool().is_closed());Trait Implementations§
Source§impl Clone for PostgresBackend
impl Clone for PostgresBackend
Source§fn clone(&self) -> PostgresBackend
fn clone(&self) -> PostgresBackend
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 StorageBackend for PostgresBackend
impl StorageBackend for PostgresBackend
Source§fn capabilities(&self) -> BackendCapabilities
fn capabilities(&self) -> BackendCapabilities
Declares this backend’s storage and coordination capabilities.
Source§fn as_stream(&self) -> Option<&dyn StreamBackend>
fn as_stream(&self) -> Option<&dyn StreamBackend>
Returns reference to StreamBackend if supported by this storage implementation.
Source§fn run_migrations<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn run_migrations<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Executes backend schema migrations or setup steps.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Performs a health check to verify backend connectivity and readiness.
Source§fn enqueue<'life0, 'async_trait>(
&'life0 self,
job: NewJob,
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
job: NewJob,
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Enqueues a new job into the backend queue.
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
queue: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Subscribes to job enqueue notification events for a specific queue.
Source§fn lease_jobs_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
fn lease_jobs_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
Leases up to
batch_size runnable jobs for a specified worker ID.Source§fn lease_jobs_batch_with_ordering<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
ordering: QueueOrdering,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
fn lease_jobs_batch_with_ordering<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
ordering: QueueOrdering,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
Leases up to
batch_size runnable jobs with specified queue ordering preference (QueueOrdering).Source§fn reap_expired_locks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn reap_expired_locks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Reaps expired locks from inactive workers, resetting their status back to queued.
Source§fn start_attempts_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dataset_ids: &'life1 [String],
job_ids: &'life2 [Uuid],
worker_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Uuid, Uuid, i32)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
fn start_attempts_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dataset_ids: &'life1 [String],
job_ids: &'life2 [Uuid],
worker_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Uuid, Uuid, i32)>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
Starts job execution attempt records, returning
(job_id, attempt_id, attempt_number) tuples.Source§fn mark_succeeded<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn mark_succeeded<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Marks a single job execution attempt as succeeded.
Source§fn mark_succeeded_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dataset_id: &'life1 str,
updates: &'life2 [(Uuid, Uuid, i32)],
worker_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
fn mark_succeeded_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
dataset_id: &'life1 str,
updates: &'life2 [(Uuid, Uuid, i32)],
worker_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
Marks a batch of job execution attempts as succeeded.
Source§fn reschedule_for_retry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
next_run_at: DateTime<Utc>,
error_code: &'life2 str,
error_message: &'life3 str,
_attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
fn reschedule_for_retry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
next_run_at: DateTime<Utc>,
error_code: &'life2 str,
error_message: &'life3 str,
_attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
PostgresBackend: 'async_trait,
Records a failed attempt and reschedules the job for a future retry attempt.
Source§fn mark_dlq<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
reason_code: &'life2 str,
error_code: &'life3 str,
error_message: &'life4 str,
_attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
PostgresBackend: 'async_trait,
fn mark_dlq<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
reason_code: &'life2 str,
error_code: &'life3 str,
error_message: &'life4 str,
_attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
PostgresBackend: 'async_trait,
Records a failed attempt and transitions the job to the Dead-Letter Queue (DLQ).
Source§fn archive_succeeded_older_than<'life0, 'async_trait>(
&'life0 self,
cutoff: DateTime<Utc>,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn archive_succeeded_older_than<'life0, 'async_trait>(
&'life0 self,
cutoff: DateTime<Utc>,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Moves succeeded jobs older than
cutoff into an archive table or storage location.Source§fn delete_history_for_succeeded_older_than<'life0, 'async_trait>(
&'life0 self,
cutoff: DateTime<Utc>,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<(u64, u64), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn delete_history_for_succeeded_older_than<'life0, 'async_trait>(
&'life0 self,
cutoff: DateTime<Utc>,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<(u64, u64), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Prunes attempt audit logs and decision records for succeeded jobs older than
cutoff.Source§fn get_job<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn get_job<'life0, 'async_trait>(
&'life0 self,
job_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Fetches a single job record by ID.
Source§fn list_jobs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: Option<&'life1 str>,
status: Option<&'life2 str>,
limit: i64,
cursor_created_at: Option<DateTime<Utc>>,
cursor_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JobListItem>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
fn list_jobs<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: Option<&'life1 str>,
status: Option<&'life2 str>,
limit: i64,
cursor_created_at: Option<DateTime<Utc>>,
cursor_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JobListItem>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
Fetches a list of jobs matching filters with cursor pagination.
Source§fn replay_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
override_queue: Option<&'life1 str>,
override_run_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn replay_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
override_queue: Option<&'life1 str>,
override_run_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<Uuid, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Atomically replays a job by ID into the queue.
Source§fn perform_maintenance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
fn perform_maintenance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
PostgresBackend: 'async_trait,
Performs database maintenance (e.g., VACUUM ANALYZE in Postgres, PRAGMA incremental_vacuum in SQLite).
Source§fn extend_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_id: &'life1 str,
lease_seconds: i64,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn extend_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_id: &'life1 str,
lease_seconds: i64,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Extends the lease lock expiration for an in-flight running job.
Returns
true if the lease was extended, false if the job lock was lost or reaped.Source§fn cancel_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn cancel_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
worker_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Cancels a queued/scheduled job or a running job owned by
worker_id. Read moreSource§fn semantic_capabilities(&self) -> Option<BackendSemanticCapabilities>
fn semantic_capabilities(&self) -> Option<BackendSemanticCapabilities>
Declares detailed semantic strength for this backend. Read more
Source§fn as_observability(&self) -> Option<&dyn ObservabilityBackend>
fn as_observability(&self) -> Option<&dyn ObservabilityBackend>
Returns reference to backend-native observability data if supported.
Source§fn dequeue_and_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn dequeue_and_lease<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
queue: &'life1 str,
worker_id: &'life2 str,
lease_seconds: i64,
batch_size: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Dequeues and leases up to
batch_size runnable jobs (alias for lease_jobs_batch).Source§fn complete_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn complete_job<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Marks a job attempt as completed (alias for
mark_succeeded).Source§fn retry_job<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
next_run_at: DateTime<Utc>,
error_code: &'life2 str,
error_message: &'life3 str,
attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn retry_job<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
next_run_at: DateTime<Utc>,
error_code: &'life2 str,
error_message: &'life3 str,
attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Reschedules a job for retry (alias for
reschedule_for_retry).Source§fn fail_job<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
reason_code: &'life2 str,
error_code: &'life3 str,
error_message: &'life4 str,
attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
fn fail_job<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
job_id: Uuid,
attempt_id: Uuid,
worker_id: &'life1 str,
latency_ms: i32,
reason_code: &'life2 str,
error_code: &'life3 str,
error_message: &'life4 str,
attempt_no: i32,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Moves a job to DLQ on failure (alias for
mark_dlq).Source§impl StreamBackend for PostgresBackend
impl StreamBackend for PostgresBackend
Source§fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
event: NewEvent,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
event: NewEvent,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Appends a new event to the specified stream log, returning its assigned sequence number.
Source§fn subscribe_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
last_seq: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
fn subscribe_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
last_seq: Option<i64>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = ()> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
Subscribes to notification events when new entries are appended to a stream.
Source§fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
seq: i64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
seq: i64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
PostgresBackend: 'async_trait,
Acknowledges event processing up to
seq for a consumer group on a stream log.Source§fn read_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
after_seq: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn read_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
after_seq: i64,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Reads events from a stream with sequence numbers strictly greater than
after_seq.Source§fn prune_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
through_seq: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn prune_events<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
through_seq: i64,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Source§fn consumer_group_info<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
fn consumer_group_info<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ConsumerGroupStatus>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
PostgresBackend: 'async_trait,
Fetches consumer group offset status for a stream log.
Source§fn read_next<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn read_next<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 str,
consumer_group: &'life2 str,
limit: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Reads the next events for a consumer group from its durable acknowledged offset.
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresBackend
impl !UnwindSafe for PostgresBackend
impl Freeze for PostgresBackend
impl Send for PostgresBackend
impl Sync for PostgresBackend
impl Unpin for PostgresBackend
impl UnsafeUnpin for PostgresBackend
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