Skip to main content

OperationRegistry

Struct OperationRegistry 

Source
pub struct OperationRegistry { /* private fields */ }
Expand description

Typed operation dispatcher with an explicit scope authorizer and schema compatibility window.

Implementations§

Source§

impl OperationRegistry

Source

pub fn new<A>(scope_authorizer: A) -> Self
where A: ScopeAuthorizer + 'static,

Creates an empty registry. Requiring an authorizer prevents an accidental allow-all scope.

Source

pub fn register<O, H>( &mut self, handler: H, ) -> Result<&mut Self, RegistrationError>
where O: DomainOperation, H: OperationHandler<O> + 'static,

Registers a handler for only its current payload schema.

§Errors

Returns RegistrationError::Duplicate when the operation kind is already registered.

Source

pub fn register_with_migration<O, H, M>( &mut self, minimum_schema: u16, handler: H, migrator: M, ) -> Result<&mut Self, RegistrationError>
where O: DomainOperation, H: OperationHandler<O> + 'static, M: PayloadMigrator + 'static,

Registers a handler and direct migration adapter for a bounded historical schema window.

§Errors

Returns RegistrationError for duplicate kinds or an invalid compatibility window.

Trait Implementations§

Source§

impl OperationExecutor for OperationRegistry

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.