Skip to main content

OperationExecutor

Trait OperationExecutor 

Source
pub trait OperationExecutor: Send + Sync {
    // Required methods
    fn authorize_scope<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        auth: &'life1 AuthContext,
        session: &'life2 SessionMetadata,
    ) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn authorize<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        auth: &'life1 AuthContext,
        operation: AuthenticatedOperation<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<AuthorizedOperation<'a>, ExecutionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        auth: &'life1 AuthContext,
        operation: ExecutableOperation<'life2>,
        current: Option<&'life3 CurrentEntity>,
    ) -> Pin<Box<dyn Future<Output = Result<AuthoritativeMutation, ExecutionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Application operation registry/dispatcher.

Implementations decode operation.payload according to operation_kind, authorize against AuthContext, validate business rules, and return an authoritative mutation.

Required Methods§

Source

fn authorize_scope<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, auth: &'life1 AuthContext, session: &'life2 SessionMetadata, ) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Authorizes a requested partial sync scope before any entity or journal data is read.

Source

fn authorize<'a, 'life0, 'life1, 'async_trait>( &'life0 self, auth: &'life1 AuthContext, operation: AuthenticatedOperation<'a>, ) -> Pin<Box<dyn Future<Output = Result<AuthorizedOperation<'a>, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Authorizes an operation before authoritative state is disclosed or conflict-tested.

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, auth: &'life1 AuthContext, operation: ExecutableOperation<'life2>, current: Option<&'life3 CurrentEntity>, ) -> Pin<Box<dyn Future<Output = Result<AuthoritativeMutation, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Validates business rules and executes an authorized operation into a store-independent mutation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§