Skip to main content

AsyncLifecycleContext

Struct AsyncLifecycleContext 

Source
pub struct AsyncLifecycleContext<'storage, A, R, P>
where A: AggregateRoot + Send + 'storage, R: AsyncRepository<Aggregate = A> + Send + 'storage, P: AsyncDomainEventPublisher<Event = <A as AggregateRoot>::Event> + Send + 'storage, <A as AggregateRoot>::Event: Send + Sync + 'storage, <R as AsyncRepository>::Error: Send + 'storage, <P as AsyncDomainEventPublisher>::Error: Send + 'storage,
{ /* private fields */ }
Expand description

English:
Coordinates asynchronous aggregate persistence and event dispatch. Each operation may be attempted once; dropping an in-progress future consumes that attempt.

日本語:
非同期の集約永続化とイベント配信を調整します。各操作は一度だけ試行でき、実行中の future を破棄すると試行は消費済みになります。

Implementations§

Source§

impl<'storage, A, R, P> AsyncLifecycleContext<'storage, A, R, P>
where A: AggregateRoot + Send + 'storage, R: AsyncRepository<Aggregate = A> + Send + 'storage, P: AsyncDomainEventPublisher<Event = <A as AggregateRoot>::Event> + Send + 'storage, <A as AggregateRoot>::Event: Send + Sync + 'storage, <R as AsyncRepository>::Error: Send + 'storage, <P as AsyncDomainEventPublisher>::Error: Send + 'storage,

Source

pub fn new( aggregate: &'storage mut A, repository: &'storage mut R, publisher: &'storage mut P, ) -> AsyncLifecycleContext<'storage, A, R, P>

English:
Creates a lifecycle context borrowing the aggregate, repository, and publisher mutably.

日本語:
集約、リポジトリ、パブリッシャーを可変借用するライフサイクルコンテキストを作成します。

Source

pub fn save<'ctx>( &'ctx mut self, ) -> Pin<Box<dyn Future<Output = Result<(), LifecycleOperationError<<R as AsyncRepository>::Error>>> + Send + 'ctx>>
where 'storage: 'ctx, A: Send + 'ctx, R: Send + 'ctx, <R as AsyncRepository>::Error: Send + 'ctx,

English:
Attempts repository persistence once; adapter errors are returned and the attempt cannot be retried.

日本語:
リポジトリへの保存を一度試行します。アダプターエラーを返し、再試行はできません。

Source

pub fn dispatch<'ctx>( &'ctx mut self, ) -> Pin<Box<dyn Future<Output = Result<(), LifecycleOperationError<<P as AsyncDomainEventPublisher>::Error>>> + Send + 'ctx>>
where 'storage: 'ctx, A: Send + 'ctx, P: Send + 'ctx, <A as AggregateRoot>::Event: Send + Sync + 'ctx, <P as AsyncDomainEventPublisher>::Error: Send + 'ctx,

English:
Attempts event dispatch once; adapter errors are returned and the attempt cannot be retried.

日本語:
イベント配信を一度試行します。アダプターエラーを返し、再試行はできません。

Source

pub fn complete(self) -> Result<(), LifecycleCompletionError>

English:
Consumes the context and succeeds only when both save and dispatch succeeded.

日本語:
コンテキストを消費し、保存と配信の両方が成功した場合にのみ成功します。

Auto Trait Implementations§

§

impl<'storage, A, R, P> !UnwindSafe for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> Freeze for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> RefUnwindSafe for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> Send for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> Sync for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> Unpin for AsyncLifecycleContext<'storage, A, R, P>

§

impl<'storage, A, R, P> UnsafeUnpin for AsyncLifecycleContext<'storage, A, R, P>

Blanket Implementations§

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, 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, !>

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.