common_procedure

Trait Procedure

Source
pub trait Procedure: Send {
    // Required methods
    fn type_name(&self) -> &str;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = Result<Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn dump(&self) -> Result<String>;
    fn lock_key(&self) -> LockKey;

    // Provided methods
    fn rollback<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn rollback_supported(&self) -> bool { ... }
    fn recover(&mut self) -> Result<()> { ... }
}
Expand description

A Procedure represents an operation or a set of operations to be performed step-by-step.

Required Methods§

Source

fn type_name(&self) -> &str

Type name of the procedure.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the procedure.

The implementation must be idempotent.

Source

fn dump(&self) -> Result<String>

Dump the state of the procedure to a string.

Source

fn lock_key(&self) -> LockKey

Returns the LockKey that this procedure needs to acquire.

Provided Methods§

Source

fn rollback<'life0, 'life1, 'async_trait>( &'life0 mut self, _: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Rollback the failed procedure.

The implementation must be idempotent.

Source

fn rollback_supported(&self) -> bool

Indicates whether it supports rolling back the procedure.

Source

fn recover(&mut self) -> Result<()>

The hook is called after the procedure recovery.

Implementations on Foreign Types§

Source§

impl<T: Procedure + ?Sized> Procedure for Box<T>

Source§

fn type_name(&self) -> &str

Source§

fn execute<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn rollback<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn rollback_supported(&self) -> bool

Source§

fn dump(&self) -> Result<String>

Source§

fn lock_key(&self) -> LockKey

Implementors§