Skip to main content

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<()> { ... }
    fn poison_keys(&self) -> PoisonKeys { ... }
    fn event(&self, _ctx: &EventContext<'_>) -> Option<Box<dyn Event>> { ... }
}
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.

Source

fn poison_keys(&self) -> PoisonKeys

Returns the PoisonKeys that may cause this procedure to become poisoned during execution.

Source

fn event(&self, _ctx: &EventContext<'_>) -> Option<Box<dyn Event>>

Builds an event for a framework lifecycle trigger.

The hook is called with the current procedure instance, so an event can include state that was produced after the procedure was submitted. A return value of None means that this trigger should not be recorded. Events that share an [Event::event_type] must return identical [Event::extra_schema] values. The event recorder batches events by type and rejects incompatible schemas; use a distinct event type for a different schema.

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

Source§

fn poison_keys(&self) -> PoisonKeys

Source§

fn event(&self, ctx: &EventContext<'_>) -> Option<Box<dyn Event>>

Implementors§