pub trait TaskStore: Send + Sync {
// Required methods
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load<'life0, 'async_trait>(
&'life0 self,
id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Task>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update<'life0, 'async_trait>(
&'life0 self,
id: TaskId,
update: TaskUpdate,
) -> Pin<Box<dyn Future<Output = Result<Task>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Persistence interface for tasks.
Implementations must make TaskStore::update atomic with respect to
concurrent writers, including other processes sharing the same state
directory.
Required Methods§
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts or replaces the stored task.
Sourcefn load<'life0, 'async_trait>(
&'life0 self,
id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Task>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Task>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads a task by id, or fails with Error::TaskNotFound when absent.
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Task>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns all stored tasks ordered by creation time.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".