pub struct CommitBuilder<'a, R> { /* private fields */ }Expand description
Builder for chaining multiple items into one transactional commit batch.
This is the single builder behind every commit entry point; staging state is
the stream writes plus the [StagedOutboxSource]. aggregate
hands back a StagedCommitBuilder, whose no-argument commit() finishes
the same batch.
Implementations§
Source§impl<'a, R> CommitBuilder<'a, R>
impl<'a, R> CommitBuilder<'a, R>
pub fn new(repo: &'a R) -> Self
Sourcepub fn read_models(self, read_models: ReadModelWritePlanBuilder) -> Self
pub fn read_models(self, read_models: ReadModelWritePlanBuilder) -> Self
Add a read-model write plan builder to the commit.
Sourcepub fn outbox(self, msg: OutboxMessage) -> Self
pub fn outbox(self, msg: OutboxMessage) -> Self
Add an outbox message to the commit.
Sourcepub fn aggregate<A: Aggregate>(
self,
aggregate: &'a mut A,
) -> StagedCommitBuilder<'a, R>
pub fn aggregate<A: Aggregate>( self, aggregate: &'a mut A, ) -> StagedCommitBuilder<'a, R>
Stage an aggregate and switch to a no-argument staged commit builder.
Sourcepub async fn commit<A: Aggregate + Send>(
self,
aggregate: &'a mut A,
) -> Result<(), RepositoryError>where
R: TransactionalCommit,
pub async fn commit<A: Aggregate + Send>(
self,
aggregate: &'a mut A,
) -> Result<(), RepositoryError>where
R: TransactionalCommit,
Commit all items plus the primary aggregate.
Sugar for aggregate(aggregate).commit().
Sourcepub async fn commit_many<'b, A: Aggregate + Send>(
self,
aggregates: &'a mut [&'b mut A],
) -> Result<(), RepositoryError>where
R: TransactionalCommit,
pub async fn commit_many<'b, A: Aggregate + Send>(
self,
aggregates: &'a mut [&'b mut A],
) -> Result<(), RepositoryError>where
R: TransactionalCommit,
Commit multiple aggregates of the same type in one batch.
Sourcepub async fn commit_all(self) -> Result<(), RepositoryError>where
R: TransactionalCommit,
pub async fn commit_all(self) -> Result<(), RepositoryError>where
R: TransactionalCommit,
Commit without a primary aggregate.
Auto Trait Implementations§
impl<'a, R> !RefUnwindSafe for CommitBuilder<'a, R>
impl<'a, R> !UnwindSafe for CommitBuilder<'a, R>
impl<'a, R> Freeze for CommitBuilder<'a, R>
impl<'a, R> Send for CommitBuilder<'a, R>
impl<'a, R> Sync for CommitBuilder<'a, R>
impl<'a, R> Unpin for CommitBuilder<'a, R>
impl<'a, R> UnsafeUnpin for CommitBuilder<'a, R>where
&'a R: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> AggregateBuilder for T
impl<T> AggregateBuilder for T
fn aggregate<A: Aggregate>(self) -> AggregateRepository<Self, A>
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> Queueable for T
impl<T> Queueable for T
Source§fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
fn queued(self) -> QueuedRepository<Self, InMemoryLockManager>
Wrap with the default async lock manager. Pair with
.aggregate::<T>() for per-aggregate serialization over the async
repository surface.Source§fn queued_with<L: LockManager>(
self,
lock_manager: L,
) -> QueuedRepository<Self, L>
fn queued_with<L: LockManager>( self, lock_manager: L, ) -> QueuedRepository<Self, L>
Wrap with a custom async lock manager.