pub trait TaskStore: Send + Sync {
// Required methods
fn upsert<'life0, 'async_trait>(
&'life0 self,
stored: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTask>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTask>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn compare_and_update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Required Methods§
Sourcefn upsert<'life0, 'async_trait>(
&'life0 self,
stored: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert<'life0, 'async_trait>(
&'life0 self,
stored: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new task or replace an existing one.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a task snapshot by id, or None if absent.
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: &'life1 TaskFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTask>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List task snapshots matching filter, ordered by creation (oldest first).
Provided Methods§
Sourcefn compare_and_update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compare_and_update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: StoredTask,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically replace the stored task for task_id when the currently
stored status may transition to the update’s status (per
TaskStatus::can_transition_to). Returns true when the update was
applied.
0.22.0 audit fix: this closes the check-then-act window where a
handler read a task, validated its status, and wrote it back — a
concurrent writer (e.g. tasks/cancel racing the chain completing)
could overwrite the other’s terminal state in between. The default
implementation is a racy get + upsert fallback; backends that can
should override it with a truly atomic operation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".