pub trait EventStore {
type Aggregate: AggregateRoot;
type Error;
// Required methods
fn load(
&self,
id: &<Self::Aggregate as Entity>::Id,
) -> Result<LoadResult<<Self::Aggregate as AggregateRoot>::Event>, Self::Error>;
fn append(
&mut self,
id: &<Self::Aggregate as Entity>::Id,
expected: ExpectedRevision,
events: Vec<<Self::Aggregate as AggregateRoot>::Event>,
) -> Result<AppendResult, AppendError<Self::Error>>;
}Expand description
English:
Synchronous persistence boundary for aggregate event streams.
Implementations define atomicity, durability, concurrent-writer coordination, and panic
conditions; this trait supplies no storage or locking implementation.
日本語:
集約イベントストリームの同期永続化境界です。
原子性、永続性、並行書き込みの調整、パニック条件は実装が定めます。
このトレイト自体はストレージやロックを実装しません。
Required Associated Types§
Sourcetype Aggregate: AggregateRoot
type Aggregate: AggregateRoot
English:
Aggregate defining the identifier and event types to store.
日本語:
保存する識別子とイベントの型を定める集約です。
Required Methods§
Sourcefn load(
&self,
id: &<Self::Aggregate as Entity>::Id,
) -> Result<LoadResult<<Self::Aggregate as AggregateRoot>::Event>, Self::Error>
fn load( &self, id: &<Self::Aggregate as Entity>::Id, ) -> Result<LoadResult<<Self::Aggregate as AggregateRoot>::Event>, Self::Error>
English:
Loads the complete history for id, or reports an absent stream.
Storage failures are returned as Self::Error, not as stream absence.
日本語:
id の完全な履歴を読み込むか、ストリームの不在を報告します。
ストレージ障害は不在として扱わず、Self::Error として返します。
Sourcefn append(
&mut self,
id: &<Self::Aggregate as Entity>::Id,
expected: ExpectedRevision,
events: Vec<<Self::Aggregate as AggregateRoot>::Event>,
) -> Result<AppendResult, AppendError<Self::Error>>
fn append( &mut self, id: &<Self::Aggregate as Entity>::Id, expected: ExpectedRevision, events: Vec<<Self::Aggregate as AggregateRoot>::Event>, ) -> Result<AppendResult, AppendError<Self::Error>>
English:
Consumes a batch to append in vector order under the expected stream state.
Returns the final revision or an AppendError for an empty batch, conflict, revision
exhaustion, or adapter failure. The batch is not returned on failure; consult the adapter
contract for partial-write and retry behavior.
日本語:
バッチを消費し、expected のストリーム状態を条件にベクター順で追加します。
最終リビジョン、または空バッチ・競合・リビジョン枯渇・アダプター障害を示す
AppendError を返します。失敗時にバッチは返されません。部分書き込みや再試行の
挙動はアダプターの契約を確認してください。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".