Skip to main content

Executor

Trait Executor 

Source
pub trait Executor {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn receipt(&self, draft: &str) -> Result<Option<Execution>, Self::Error>;
    fn execute_and_record(
        &mut self,
        draft: &ApprovedDraft,
    ) -> Result<Execution, Self::Error>;
}
Expand description

An atomic, durable product ledger; the library owns no store or authority.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

A product storage or execution failure.

Required Methods§

Source

fn receipt(&self, draft: &str) -> Result<Option<Execution>, Self::Error>

Read the committed outcome before attempting execution.

§Errors

Returns the product’s storage error when its committed ledger cannot be read. An id with no committed outcome returns Ok(None).

Source

fn execute_and_record( &mut self, draft: &ApprovedDraft, ) -> Result<Execution, Self::Error>

Atomically apply and record once per draft id; concurrent calls return the same receipt. A stored id with another digest must be refused without applying anything.

§Errors

Returns the product’s execution or storage error when the atomic act and its durable receipt cannot be completed or read back.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§