Skip to main content

ProcedureManager

Trait ProcedureManager 

Source
pub trait ProcedureManager:
    Send
    + Sync
    + 'static {
    // Required methods
    fn register_loader(
        &self,
        name: &str,
        loader: BoxedProcedureLoader,
    ) -> Result<()>;
    fn start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn submit<'life0, 'async_trait>(
        &'life0 self,
        procedure: ProcedureWithId,
    ) -> Pin<Box<dyn Future<Output = Result<Watcher>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn procedure_state<'life0, 'async_trait>(
        &'life0 self,
        procedure_id: ProcedureId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ProcedureState>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn procedure_watcher(&self, procedure_id: ProcedureId) -> Option<Watcher>;
    fn list_procedures<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ProcedureInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn has_unfinished_procedure<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        type_names: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

ProcedureManager executes Procedure submitted to it.

Required Methods§

Source

fn register_loader( &self, name: &str, loader: BoxedProcedureLoader, ) -> Result<()>

Registers loader for specific procedure type name.

Source

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

Starts the background GC task.

Recovers unfinished procedures and reruns them.

Callers should ensure all loaders are registered.

Source

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

Stops the background GC task.

Source

fn submit<'life0, 'async_trait>( &'life0 self, procedure: ProcedureWithId, ) -> Pin<Box<dyn Future<Output = Result<Watcher>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submits a procedure to execute.

Returns a Watcher to watch the created procedure.

Source

fn procedure_state<'life0, 'async_trait>( &'life0 self, procedure_id: ProcedureId, ) -> Pin<Box<dyn Future<Output = Result<Option<ProcedureState>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query the procedure state.

Returns Ok(None) if the procedure doesn’t exist.

Source

fn procedure_watcher(&self, procedure_id: ProcedureId) -> Option<Watcher>

Returns a Watcher to watch ProcedureState of specific procedure.

Source

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

Returns the details of the procedure.

Source

fn has_unfinished_procedure<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, type_names: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns whether persisted unfinished procedures contain any requested type.

This inspects durable state without submitting procedures for execution.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§