Skip to main content

TaskStore

Trait TaskStore 

Source
pub trait TaskStore: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn create<'life0, 'async_trait>(
        &'life0 self,
        record: TaskRecord,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
    ) -> Pin<Box<dyn Future<Output = Result<TaskRecord, TaskStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRecord>, TaskStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 TaskId,
        status: TaskRecordStatus,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persistence interface for Task records — the work-item identity layer of the issue #13 ID hierarchy.

Required Methods§

Source

fn name(&self) -> &str

Backend name — for diagnostics/logging.

Source

fn create<'life0, 'async_trait>( &'life0 self, record: TaskRecord, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new Task row. Returns Duplicate if record.id is already stored.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<TaskRecord, TaskStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a Task by id.

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRecord>, TaskStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List every Task, newest first (descending created_at).

Source

fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, status: TaskRecordStatus, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update a Task’s status, bumping updated_at to now.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§