pub struct AggregateHandle<A: Aggregate> { /* private fields */ }Expand description
Implementations§
Source§impl<A: Aggregate> AggregateHandle<A>
impl<A: Aggregate> AggregateHandle<A>
Sourcepub async fn execute(
&self,
cmd: A::Command,
ctx: CommandContext,
) -> Result<Vec<A::DomainEvent>, ExecuteError<A::Error>>
pub async fn execute( &self, cmd: A::Command, ctx: CommandContext, ) -> Result<Vec<A::DomainEvent>, ExecuteError<A::Error>>
Send a command to the aggregate and wait for the result.
Returns the domain events produced by the command on success.
§Arguments
cmd- The domain command to execute against the aggregate.ctx- Cross-cutting metadata (actor identity, correlation ID, etc.).
§Returns
The domain events produced by the command on success.
§Errors
ExecuteError::Domain– the aggregate rejected the command.ExecuteError::Io– a disk I/O error occurred.ExecuteError::ActorGone– the actor thread has exited.
Sourcepub async fn state(&self) -> Result<A, StateError>
pub async fn state(&self) -> Result<A, StateError>
Read the current aggregate state.
Refreshes the view from disk before returning.
§Returns
A clone of the current aggregate state.
§Errors
StateError::Io– a disk I/O error occurred.StateError::ActorGone– the actor thread has exited.
Sourcepub fn reader(&self) -> &EventReader
pub fn reader(&self) -> &EventReader
Returns a reference to the EventReader for this aggregate’s stream.
Trait Implementations§
Source§impl<A: Aggregate> Clone for AggregateHandle<A>
impl<A: Aggregate> Clone for AggregateHandle<A>
Auto Trait Implementations§
impl<A> Freeze for AggregateHandle<A>
impl<A> RefUnwindSafe for AggregateHandle<A>
impl<A> Send for AggregateHandle<A>
impl<A> Sync for AggregateHandle<A>
impl<A> Unpin for AggregateHandle<A>
impl<A> UnsafeUnpin for AggregateHandle<A>
impl<A> UnwindSafe for AggregateHandle<A>
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