Skip to main content

CommitBuilder

Struct CommitBuilder 

Source
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>

Source

pub fn new(repo: &'a R) -> Self

Source

pub fn read_models(self, read_models: ReadModelWritePlanBuilder) -> Self

Add a read-model write plan builder to the commit.

Source

pub fn outbox(self, msg: OutboxMessage) -> Self

Add an outbox message to the commit.

Source

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.

Source

pub async fn commit<A: Aggregate + Send>( self, aggregate: &'a mut A, ) -> Result<(), RepositoryError>

Commit all items plus the primary aggregate.

Sugar for aggregate(aggregate).commit().

Source

pub async fn commit_many<'b, A: Aggregate + Send>( self, aggregates: &'a mut [&'b mut A], ) -> Result<(), RepositoryError>

Commit multiple aggregates of the same type in one batch.

Source

pub async fn commit_all(self) -> Result<(), RepositoryError>

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>
where &'a R: Freeze,

§

impl<'a, R> Send for CommitBuilder<'a, R>
where &'a R: Send,

§

impl<'a, R> Sync for CommitBuilder<'a, R>
where &'a R: Sync,

§

impl<'a, R> Unpin for CommitBuilder<'a, R>
where &'a R: Unpin,

§

impl<'a, R> UnsafeUnpin for CommitBuilder<'a, R>

Blanket Implementations§

Source§

impl<T> AggregateBuilder for T

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> Queueable for T

Source§

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>

Wrap with a custom async lock manager.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, <T as TryFrom<U>>::Error>

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.