pub struct CommandJournal<'a, R: CommandRunner, S: EventStore> { /* private fields */ }Expand description
Wraps a CommandRunner and persists execution events to an EventStore.
Implementations§
Source§impl<'a, R: CommandRunner, S: EventStore> CommandJournal<'a, R, S>
impl<'a, R: CommandRunner, S: EventStore> CommandJournal<'a, R, S>
pub fn new(runner: R, store: &'a S) -> Self
Sourcepub fn with_audit_sink(self, sink: &'a dyn AuditSink) -> Self
pub fn with_audit_sink(self, sink: &'a dyn AuditSink) -> Self
Set an optional audit sink for command execution events.
Sourcepub async fn execute(
&self,
request: CommandRequest,
cancel: CancellationToken,
) -> Result<CommandResult, ExecError>
pub async fn execute( &self, request: CommandRequest, cancel: CancellationToken, ) -> Result<CommandResult, ExecError>
Execute a command and persist all events to the store.
Events persisted:
command.started— when the command begins execution.command.output— one event per stream chunk (batched by configurable threshold).command.completed— terminal event with exit code and timing.
Auto Trait Implementations§
impl<'a, R, S> Freeze for CommandJournal<'a, R, S>where
R: Freeze,
impl<'a, R, S> !RefUnwindSafe for CommandJournal<'a, R, S>
impl<'a, R, S> Send for CommandJournal<'a, R, S>
impl<'a, R, S> Sync for CommandJournal<'a, R, S>
impl<'a, R, S> Unpin for CommandJournal<'a, R, S>where
R: Unpin,
impl<'a, R, S> UnsafeUnpin for CommandJournal<'a, R, S>where
R: UnsafeUnpin,
impl<'a, R, S> !UnwindSafe for CommandJournal<'a, R, S>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request