Skip to main content

OperationRepository

Trait OperationRepository 

Source
pub trait OperationRepository: Send + Sync {
    // Required methods
    fn fail_unfinished_session_operations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        reason: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_cancel_requested_for_operation<'life0, 'life1, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_session_operation_unfinished<'life0, 'life1, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_unfinished_session_operations<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SessionOperationRow>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mark_session_operation_canceled<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
        reason: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn mark_session_operation_done<'life0, 'life1, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn mark_session_operation_failed<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
        error: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn mark_session_operation_running<'life0, 'life1, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn claim_session_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
        session_id: &'life2 str,
        kind: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn insert_session_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        operation_id: &'life1 str,
        session_id: &'life2 str,
        kind: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn request_cancel_for_session_operations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Session-operation persistence boundary used by app orchestration and tests.

Required Methods§

Source

fn fail_unfinished_session_operations<'life0, 'life1, 'async_trait>( &'life0 self, reason: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Marks unfinished operations as failed after process restart.

Source

fn is_cancel_requested_for_operation<'life0, 'life1, 'async_trait>( &'life0 self, operation_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns whether cancellation is requested for a specific operation.

Source

fn is_session_operation_unfinished<'life0, 'life1, 'async_trait>( &'life0 self, operation_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns whether an operation is still unfinished.

Source

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

Loads operations still waiting in queue or currently running.

Source

fn mark_session_operation_canceled<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, operation_id: &'life1 str, reason: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Marks an operation as canceled.

Source

fn mark_session_operation_done<'life0, 'life1, 'async_trait>( &'life0 self, operation_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Marks an operation as completed successfully.

Source

fn mark_session_operation_failed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, operation_id: &'life1 str, error: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Marks an operation as failed with an error message.

Source

fn mark_session_operation_running<'life0, 'life1, 'async_trait>( &'life0 self, operation_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Marks an operation as running and refreshes its heartbeat timestamp.

Source

fn claim_session_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, operation_id: &'life1 str, session_id: &'life2 str, kind: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Claims an idempotent queued operation.

Returns true when the caller must enqueue the command. Existing queued, running, or completed operations return false; failed or canceled attempts are reset and reclaimed for restart recovery.

Source

fn insert_session_operation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, operation_id: &'life1 str, session_id: &'life2 str, kind: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Inserts a queued operation row for a session.

Source

fn request_cancel_for_session_operations<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests cancellation for unfinished operations of a session.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§