pub struct PostgresResultBackend { /* private fields */ }Expand description
PostgreSQL result backend implementation
Implementations§
Source§impl PostgresResultBackend
impl PostgresResultBackend
Sourcepub async fn new(database_url: &str) -> Result<Self>
pub async fn new(database_url: &str) -> Result<Self>
Create a new PostgreSQL result backend
§Arguments
database_url- PostgreSQL connection string (e.g., “postgres://user:pass@localhost/db”)
Sourcepub fn with_ttl_config(self, config: TaskTtlConfig) -> Self
pub fn with_ttl_config(self, config: TaskTtlConfig) -> Self
Configure per-task-type TTL
Sourcepub fn ttl_config(&self) -> &TaskTtlConfig
pub fn ttl_config(&self) -> &TaskTtlConfig
Get the TTL configuration
Sourcepub fn ttl_config_mut(&mut self) -> &mut TaskTtlConfig
pub fn ttl_config_mut(&mut self) -> &mut TaskTtlConfig
Get a mutable reference to the TTL configuration
Sourcepub async fn cleanup_expired(&self) -> Result<usize>
pub async fn cleanup_expired(&self) -> Result<usize>
Clean up expired results (returns number of deleted rows)
Trait Implementations§
Source§impl Clone for PostgresResultBackend
impl Clone for PostgresResultBackend
Source§fn clone(&self) -> PostgresResultBackend
fn clone(&self) -> PostgresResultBackend
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 ResultBackend for PostgresResultBackend
impl ResultBackend for PostgresResultBackend
Source§fn store_result<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
meta: &'life1 TaskMeta,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_result<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
meta: &'life1 TaskMeta,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store task result
Source§fn get_result<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_result<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get task result
Source§fn delete_result<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_result<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete task result
Source§fn set_expiration<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_expiration<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set task result expiration
Source§fn chord_init<'life0, 'async_trait>(
&'life0 mut self,
state: ChordState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chord_init<'life0, 'async_trait>(
&'life0 mut self,
state: ChordState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Chord: Initialize chord state
Source§fn chord_complete_task<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chord_complete_task<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Chord: Increment completion counter (returns total completed)
Source§fn chord_get_state<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ChordState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chord_get_state<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ChordState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Chord: Get chord state
Source§fn store_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
results: &'life1 [(Uuid, TaskMeta)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
results: &'life1 [(Uuid, TaskMeta)],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store multiple task results (optimized with pipelining where supported)
Source§fn get_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<TaskMeta>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<TaskMeta>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get multiple task results (optimized with pipelining where supported)
Source§fn delete_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_results_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete multiple task results (optimized with pipelining where supported)
Source§fn chord_cancel<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn chord_cancel<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Chord: Cancel a chord
Source§fn chord_get_partial_results<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Uuid, Option<TaskMeta>)>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn chord_get_partial_results<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Uuid, Option<TaskMeta>)>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Chord: Get partial results for all tasks in chord Read more
Source§fn chord_retry<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn chord_retry<'life0, 'async_trait>(
&'life0 mut self,
chord_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Chord: Retry a failed chord Read more
Source§fn store_versioned_result<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
meta: &'life1 TaskMeta,
) -> Pin<Box<dyn Future<Output = Result<u32, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn store_versioned_result<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
meta: &'life1 TaskMeta,
) -> Pin<Box<dyn Future<Output = Result<u32, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Store a versioned result Read more
Source§fn get_result_version<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
_version: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMeta>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_result_version<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
_version: u32,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMeta>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get a specific version of a result Read more
Source§fn set_progress<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
progress: ProgressInfo,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn set_progress<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
progress: ProgressInfo,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Update task progress (for long-running tasks) Read more
Source§fn get_progress<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProgressInfo>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_progress<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<ProgressInfo>, BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get task progress Read more
Source§fn update_result_state<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
result: TaskResult,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn update_result_state<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
result: TaskResult,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Update only the task result state (without changing other fields) Read more
Source§fn update_worker<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
worker: String,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn update_worker<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
worker: String,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Update only the worker field
Source§fn mark_started<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
worker: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn mark_started<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
worker: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Mark task as started (updates state and timestamp)
Source§fn mark_completed<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
result: TaskResult,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn mark_completed<'life0, 'async_trait>(
&'life0 mut self,
task_id: Uuid,
result: TaskResult,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Mark task as completed with result
Source§fn get_results_paginated<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
page: usize,
page_size: usize,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Option<TaskMeta>>, usize, bool), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_results_paginated<'life0, 'life1, 'async_trait>(
&'life0 mut self,
task_ids: &'life1 [Uuid],
page: usize,
page_size: usize,
) -> Pin<Box<dyn Future<Output = Result<(Vec<Option<TaskMeta>>, usize, bool), BackendError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get paginated task results Read more
Source§impl ResultStore for PostgresResultBackend
impl ResultStore for PostgresResultBackend
Source§fn store_result<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
result: TaskResultValue,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_result<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
result: TaskResultValue,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store a task result
Source§fn get_result<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskResultValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_result<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskResultValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a task result
Source§fn get_state<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<TaskState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_state<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<TaskState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get task state
Auto Trait Implementations§
impl Freeze for PostgresResultBackend
impl !RefUnwindSafe for PostgresResultBackend
impl Send for PostgresResultBackend
impl Sync for PostgresResultBackend
impl Unpin for PostgresResultBackend
impl UnsafeUnpin for PostgresResultBackend
impl !UnwindSafe for PostgresResultBackend
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