pub struct LifecycleContext<'a, A, R, P>where
A: AggregateRoot,
R: Repository<Aggregate = A>,
P: DomainEventPublisher<Event = <A as AggregateRoot>::Event>,{ /* private fields */ }Expand description
English: Exposes core 0.4’s domain, persistence, and event-workflow API.
日本語: コア 0.4 のドメイン、永続化、イベント処理 API を公開します。 English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
日本語: 同期・非同期の CQRS ハンドラー、集約作成器、ライフサイクル API を再エクスポートします。 English: Re-exports synchronous command and query handlers, aggregate creators, lifecycle callbacks, and the context coordinating aggregate saves and event dispatch.
日本語: 同期のコマンド・クエリハンドラー、集約作成器、ライフサイクルコールバック、 集約保存とイベント配信を調整するコンテキストを再エクスポートします。 English: Coordinates one synchronous aggregate save and event dispatch sequence.
日本語: 同期の集約保存とイベント配信を一連で調整します。
Implementations§
Source§impl<'a, A, R, P> LifecycleContext<'a, A, R, P>where
A: AggregateRoot,
R: Repository<Aggregate = A>,
P: DomainEventPublisher<Event = <A as AggregateRoot>::Event>,
impl<'a, A, R, P> LifecycleContext<'a, A, R, P>where
A: AggregateRoot,
R: Repository<Aggregate = A>,
P: DomainEventPublisher<Event = <A as AggregateRoot>::Event>,
Sourcepub fn new(
aggregate: &'a mut A,
repository: &'a mut R,
publisher: &'a mut P,
) -> LifecycleContext<'a, A, R, P>
pub fn new( aggregate: &'a mut A, repository: &'a mut R, publisher: &'a mut P, ) -> LifecycleContext<'a, A, R, P>
English: Creates a lifecycle context borrowing the aggregate, repository, and publisher mutably.
日本語: 集約、リポジトリ、パブリッシャーを可変借用するライフサイクルコンテキストを作成します。
Sourcepub fn save(
&mut self,
) -> Result<(), LifecycleOperationError<<R as Repository>::Error>>
pub fn save( &mut self, ) -> Result<(), LifecycleOperationError<<R as Repository>::Error>>
English: Attempts repository persistence once; adapter errors are returned and the attempt cannot be retried.
日本語: リポジトリへの保存を一度試行します。アダプターエラーを返し、再試行はできません。
Sourcepub fn dispatch(
&mut self,
) -> Result<(), LifecycleOperationError<<P as DomainEventPublisher>::Error>>
pub fn dispatch( &mut self, ) -> Result<(), LifecycleOperationError<<P as DomainEventPublisher>::Error>>
English: Attempts event dispatch once; adapter errors are returned and the attempt cannot be retried.
日本語: イベント配信を一度試行します。アダプターエラーを返し、再試行はできません。
Sourcepub fn complete(self) -> Result<(), LifecycleCompletionError>
pub fn complete(self) -> Result<(), LifecycleCompletionError>
English: Consumes the context and succeeds only when both save and dispatch succeeded.
日本語: コンテキストを消費し、保存と配信の両方が成功した場合にのみ成功します。