pub trait IdempotentProjection {
type Event: DomainEvent;
type Cursor;
type Error;
// Required method
fn apply_once(
&mut self,
event: &Self::Event,
checkpoint: &ProjectionCheckpoint<Self::Cursor>,
) -> Result<ProjectionApplication, Self::Error>;
}Expand description
English:
Opt-in projection contract distinguishing new application from duplicate input.
This trait is independent of crate::Projection and ProjectionCheckpointStore.
Implementations supply duplicate detection, input identity, read-model changes, and any
atomic checkpoint updates or locking. No deduplication algorithm is implemented here;
adapters must define failure, retry, and panic behavior for their persistence boundary.
日本語:
新規適用と重複入力を区別する、任意のプロジェクション契約です。
このトレイトは crate::Projection と ProjectionCheckpointStore から独立しています。
重複検出、入力の識別、読み取りモデルの変更、原子的なチェックポイント更新やロックは
実装が提供します。ここでは重複排除アルゴリズムを実装しません。永続化境界における
失敗、再試行、パニック時の挙動はアダプターが定める必要があります。
Required Associated Types§
Sourcetype Event: DomainEvent
type Event: DomainEvent
English:
Domain event inspected for application to the read model.
日本語:
読み取りモデルへの適用を判断するドメインイベントです。
Required Methods§
Sourcefn apply_once(
&mut self,
event: &Self::Event,
checkpoint: &ProjectionCheckpoint<Self::Cursor>,
) -> Result<ProjectionApplication, Self::Error>
fn apply_once( &mut self, event: &Self::Event, checkpoint: &ProjectionCheckpoint<Self::Cursor>, ) -> Result<ProjectionApplication, Self::Error>
English:
Borrows event and checkpoint and reports application or a recognized duplicate.
An error does not specify whether partial updates occurred. This call does not automatically
invoke a separate checkpoint store; checkpoint meaning and persistence belong to the implementation.
日本語:
event と checkpoint を借用し、適用または認識済みの重複を報告します。
エラーだけでは部分更新の有無は決まりません。別のチェックポイントストアを自動では
呼び出さず、チェックポイントの意味と永続化は実装が定めます。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".