pub struct RuntimeController { /* private fields */ }Expand description
Coordinates lifecycle, idempotency, command dispatch, events and audit.
Implementations§
Source§impl RuntimeController
impl RuntimeController
Sourcepub fn new(instance: RuntimeInstance) -> Self
pub fn new(instance: RuntimeInstance) -> Self
Creates a controller with process-local idempotency.
Sourcepub fn with_idempotency_store(
instance: RuntimeInstance,
idempotency: Box<dyn IdempotencyStore + Send + Sync>,
) -> Self
pub fn with_idempotency_store( instance: RuntimeInstance, idempotency: Box<dyn IdempotencyStore + Send + Sync>, ) -> Self
Creates a controller with an explicit idempotency store.
Sourcepub fn instance(&self) -> &RuntimeInstance
pub fn instance(&self) -> &RuntimeInstance
Returns the hosted immutable Runtime instance.
Sourcepub fn instance_arc(&self) -> Arc<RuntimeInstance> ⓘ
pub fn instance_arc(&self) -> Arc<RuntimeInstance> ⓘ
Returns a shared reference-counted Runtime instance.
Sourcepub fn lifecycle(&self) -> &RuntimeLifecycle
pub fn lifecycle(&self) -> &RuntimeLifecycle
Returns the process lifecycle.
Sourcepub fn idempotency_len(&self) -> usize
pub fn idempotency_len(&self) -> usize
Returns the number of active idempotency records.
Sourcepub fn idempotency_contains(&self, key: &str) -> RuntimeResult<bool>
pub fn idempotency_contains(&self, key: &str) -> RuntimeResult<bool>
Reports whether an idempotency key has an active record.
Sourcepub fn apply_lifecycle_event(
&mut self,
event: RuntimeLifecycleEvent,
) -> RuntimeResult<RuntimeLifecycleState>
pub fn apply_lifecycle_event( &mut self, event: RuntimeLifecycleEvent, ) -> RuntimeResult<RuntimeLifecycleState>
Applies one process lifecycle event.
Sourcepub fn dispatch_command(
&mut self,
command: &CommandEnvelope,
context: &dyn RuntimeContext,
) -> RuntimeResult<CommandResult>
pub fn dispatch_command( &mut self, command: &CommandEnvelope, context: &dyn RuntimeContext, ) -> RuntimeResult<CommandResult>
Runs the complete command dispatch transaction.
Sourcepub fn pre_dispatch(
&self,
command: &CommandEnvelope,
) -> RuntimeResult<Option<RuntimeResult<CommandResult>>>
pub fn pre_dispatch( &self, command: &CommandEnvelope, ) -> RuntimeResult<Option<RuntimeResult<CommandResult>>>
Performs lifecycle and idempotency checks before handler execution.
Sourcepub fn post_dispatch(
&self,
command: &CommandEnvelope,
dispatch_result: &RuntimeResult<CommandResult>,
) -> RuntimeResult<()>
pub fn post_dispatch( &self, command: &CommandEnvelope, dispatch_result: &RuntimeResult<CommandResult>, ) -> RuntimeResult<()>
Persists command outcome and emits accepted events after handler execution.
Auto Trait Implementations§
impl !Freeze for RuntimeController
impl !RefUnwindSafe for RuntimeController
impl !UnwindSafe for RuntimeController
impl Send for RuntimeController
impl Sync for RuntimeController
impl Unpin for RuntimeController
impl UnsafeUnpin for RuntimeController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more