Skip to main content

Crate ddd_toolkit_core

Crate ddd_toolkit_core 

Source
Expand description

English: Core traits for modeling Domain-Driven Design entities and value objects.

日本語: ドメイン駆動設計のエンティティと値オブジェクトを表現するためのコアトレイトを提供します。

English: Entity exposes a stable identifier by reference, while ValueObject exposes a wrapped value by reference or by value. Implement these traits on domain types to keep their domain-facing APIs independent from persistence details.

日本語: Entity は安定した識別子を参照で公開し、ValueObject は内包値を参照または 値で公開します。永続化の詳細から独立したドメイン型の API を保つために、これらのトレイトを実装します。

English: For event-sourced aggregates, EventStore loads complete StreamHistory values and appends events using ExpectedRevision. AggregateReplay supplies reconstruction hooks for replay_aggregate and replay_with_optional_snapshot. SnapshotStore persists AggregateSnapshot values separately; adapters define storage and concurrency behavior.

日本語: イベントソーシングを使う集約では、EventStore が完全な StreamHistory を 読み込み、ExpectedRevision を条件にイベントを追加します。AggregateReplay は replay_aggregate と replay_with_optional_snapshot の復元フックを定めます。 SnapshotStore は AggregateSnapshot を別途永続化し、保存や並行処理の挙動は アダプターが定めます。

English: Secret wraps a value implementing zeroize::Zeroize, redacts its formatted output, and zeroizes it on drop. Access to the unredacted value is explicit; extracting it transfers responsibility for zeroization to the caller. SecretMetadata is a zero-sized marker and does not itself protect data.

日本語: Secret は zeroize::Zeroize を実装する値を包み、書式出力を秘匿化し、 破棄時にゼロ化します。秘匿化していない値には明示的にアクセスし、値を取り出した後の ゼロ化は呼び出し側が管理します。SecretMetadata はサイズがゼロのマーカーであり、 それ自体はデータを保護しません。

English: AsyncEventStore and AsyncSnapshotStore expose boxed Send futures for event and snapshot persistence. EventConsumer and Projection separate event handling from read-model updates, with asynchronous counterparts AsyncEventConsumer and AsyncProjection. DomainEventDeliveryMetadata optionally exposes DeliveryMetadata. TransactionalOutbox separates save-and-enqueue, claim, and acknowledgement operations; adapters supply transactions and delivery policies, not this crate.

日本語: AsyncEventStore と AsyncSnapshotStore はイベントとスナップショットの 永続化を、ボックス化された Send Future で公開します。EventConsumer と Projection はイベント処理と読み取りモデル更新を分け、非同期版の AsyncEventConsumer と AsyncProjection も提供します。DomainEventDeliveryMetadata は任意で DeliveryMetadata を公開します。TransactionalOutbox は保存・登録、取得、確認応答を 分離します。トランザクションと配信方針はこのクレートではなくアダプターが提供します。

English: TransactionalOutboxLifecycleContext tracks a single save-and-enqueue attempt. It pulls pending events without restoring them on failure, rejects repeated attempts, and reports missing or unsuccessful enqueueing at completion. It does not implement a transaction.

日本語: TransactionalOutboxLifecycleContext は保存・登録の一回の試行を追跡します。 保留イベントを取り出して失敗時も復元せず、繰り返しの試行を拒否し、完了確認時に 未試行や未成功を報告します。トランザクション自体は実装しません。

English: AsyncTransactionalOutbox provides future-based outbox operations. AsyncTransactionalOutboxLifecycleContext consumes an attempt and pulls events before polling; dropping its future does not restore events. ProjectionCheckpoint carries application-defined progress for ProjectionCheckpointStore, while IdempotentProjection reports applied or duplicate input via ProjectionApplication. Implementations supply duplicate detection and coordination between checkpoint persistence and read-model changes.

日本語: AsyncTransactionalOutbox は Future によるアウトボックス操作を提供します。 AsyncTransactionalOutboxLifecycleContext はポーリング前に試行を消費してイベントを取り出し、 Future の破棄でも復元しません。ProjectionCheckpoint はアプリケーション定義の進捗を ProjectionCheckpointStore に渡し、IdempotentProjection は適用または重複を ProjectionApplication で報告します。重複検出と、チェックポイント永続化・読み取りモデル変更の 連携は実装が提供します。

English: AsyncProjectionCheckpointStore persists progress through boxed Send futures, and AsyncIdempotentProjection asynchronously distinguishes new application from duplicates. These independent ports do not coordinate transactions; dropping a future does not guarantee rollback or absence of side effects. Implementations define cancellation and retry semantics.

日本語: AsyncProjectionCheckpointStore はボックス化された Send Future で進捗を永続化し、 AsyncIdempotentProjection は新規適用と重複を非同期に区別します。これらの独立したポートは トランザクションを調整せず、Future の破棄はロールバックや副作用の不在を保証しません。 キャンセルと再試行の意味は実装が定めます。

English: Specification composes fallible predicates with short-circuiting And, Or, and Not. DomainService, Policy, and DomainFactory define typed operation, rule-checking, and construction boundaries without prescribing persistence or thread safety. ProcessManager returns a Transition of state and effect descriptions for callers to store and execute. UnitOfWork exposes explicit registration, commit, and rollback ports; implementations define their transaction guarantees. EventIdentity and VersionedEvent describe event schemas, while UpcasterChain applies EventUpcaster stages in insertion order without automatically selecting versions.

日本語: Specification は失敗し得る述語を、短絡評価する And、Or、Not で 結合します。DomainService、Policy、DomainFactory は永続化やスレッド安全性を 規定せず、型付きの操作、規則確認、構築の境界を定めます。ProcessManager は状態と 副作用の記述を Transition で返し、保存と実行は呼び出し側が担います。UnitOfWork は 明示的な登録、コミット、ロールバックのポートであり、トランザクションの保証は実装が定めます。 EventIdentity と VersionedEvent はイベントのスキーマを表し、UpcasterChain は バージョンを自動選択せず、EventUpcaster の段階を追加順に適用します。

Structs§

AggregateSnapshot
English: Re-exports snapshot state containers, classification, storage contracts, and errors.
And
English: Exposes fallible specifications and their short-circuiting boolean wrappers.
AppendResult
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
AsyncLifecycleContext
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AsyncTransactionalOutboxLifecycleContext
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
DeliveryMetadata
English: Exposes delivery identifier containers and opt-in metadata access for events.
EventIdentity
English: Exposes event schema identities and insertion-ordered, fallible upcasting stages.
LifecycleContext
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
NoStream
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
Not
English: Exposes fallible specifications and their short-circuiting boolean wrappers.
Or
English: Exposes fallible specifications and their short-circuiting boolean wrappers.
OutboxClaim
English: Exposes the outbox persistence port, owned claims, and acknowledgement identifiers.
OutboxMessageId
English: Exposes the outbox persistence port, owned claims, and acknowledgement identifiers.
ProjectionCheckpoint
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
RehydratedAggregate
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.
RevisionConflict
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
Secret
English: Exposes secret::Secret for redacted formatting and zeroization on drop.
SecretMetadata
English: Exposes secret_metadata::SecretMetadata, a marker with no stored secret value.
StreamHistory
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
StreamRevision
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
TransactionalOutboxLifecycleContext
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.
Transition
English: Exposes process transition computation and owned state/effect results.
UpcasterChain
English: Exposes event schema identities and insertion-ordered, fallible upcasting stages.

Enums§

AppendError
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
AsyncTransactionalOutboxCompletionError
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
AsyncTransactionalOutboxOperationError
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
CurrentRevision
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
ExpectedRevision
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
LifecycleCompletionError
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
LifecycleOperationError
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
LoadResult
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
ProjectionApplication
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
ReplayError
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.
SnapshotLoadError
English: Re-exports snapshot state containers, classification, storage contracts, and errors.
SnapshotReplayError
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.
SnapshotSaveError
English: Re-exports snapshot state containers, classification, storage contracts, and errors.
SnapshotUse
English: Re-exports snapshot state containers, classification, storage contracts, and errors.
StreamHistoryError
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
TransactionalOutboxCompletionError
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.
TransactionalOutboxOperationError
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.

Traits§

AggregateCreator
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AggregateReplay
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.
AggregateRoot
English: Re-exports the aggregate_root::AggregateRoot trait for the crate’s public API.
AsyncAggregateCreator
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AsyncCommandHandler
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AsyncDomainEventPublisher
English: Re-exports async_domain_event_publisher::AsyncDomainEventPublisher, the trait implemented by asynchronous domain-event publishers.
AsyncEventConsumer
English: Exposes asynchronous event handling and read-model update ports.
AsyncEventStore
English: Exposes async_event_store::AsyncEventStore for future-based event persistence.
AsyncIdempotentProjection
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
AsyncLifecycleCallback
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AsyncProjection
English: Exposes asynchronous event handling and read-model update ports.
AsyncProjectionCheckpointStore
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
AsyncQueryHandler
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
AsyncRepository
English: Re-exports async_repository::AsyncRepository, the trait for asynchronous persistence operations on aggregates.
AsyncSnapshotStore
English: Exposes async_snapshot::AsyncSnapshotStore for asynchronous snapshot storage.
AsyncTransactionalOutbox
English: Exposes async_transactional_outbox::AsyncTransactionalOutbox for asynchronous save, claim, and acknowledgement.
CommandHandler
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
DomainEvent
English: Re-exports the domain_event::DomainEvent marker trait for the crate’s public API.
DomainEventConversion
English: Re-exports domain_event_conversion::DomainEventConversion for converting a domain event into another representation.
DomainEventDeliveryMetadata
English: Exposes delivery identifier containers and opt-in metadata access for events.
DomainEventMetadata
English: Re-exports domain_event_metadata::DomainEventMetadata for describing an event name, version, and optional metadata.
DomainEventPublisher
English: Re-exports the domain_event_publisher::DomainEventPublisher trait for publishing domain events.
DomainFactory
English: Exposes domain_factory::DomainFactory for fallible construction from owned input.
DomainService
English: Exposes typed domain operations and borrowed-context policy checks.
Entity
English: Re-exports the entity::Entity trait for the crate’s public API.
EventConsumer
English: Exposes synchronous event consumption and projection update contracts.
EventStore
English: Re-exports event-stream storage contracts, revision checks, and validated histories.
EventUpcaster
English: Exposes event schema identities and insertion-ordered, fallible upcasting stages.
IdempotentProjection
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
LifecycleCallback
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
Policy
English: Exposes typed domain operations and borrowed-context policy checks.
ProcessManager
English: Exposes process transition computation and owned state/effect results.
Projection
English: Exposes synchronous event consumption and projection update contracts.
ProjectionCheckpointStore
English: Exposes typed projection progress and synchronous/asynchronous checkpoint and duplicate-aware application ports.
QueryHandler
English: Re-exports synchronous and asynchronous CQRS handlers, aggregate creators, and lifecycle APIs.
Repository
English: Re-exports the repository::Repository trait for the crate’s public API.
SnapshotStore
English: Re-exports snapshot state containers, classification, storage contracts, and errors.
Specification
English: Exposes fallible specifications and their short-circuiting boolean wrappers.
TransactionalOutbox
English: Exposes the outbox persistence port, owned claims, and acknowledgement identifiers.
UnitOfWork
English: Exposes unit_of_work::UnitOfWork for explicit change registration and transaction requests.
ValueObject
English: Re-exports the value_object::ValueObject trait for the crate’s public API.
VersionedEvent
English: Exposes event schema identities and insertion-ordered, fallible upcasting stages.

Functions§

dispatch_events
English: Publishes all currently pending events from an aggregate.
dispatch_events_async
English: Re-exports async_dispatch::dispatch_events_async to publish aggregate events asynchronously with restoration of pulled events if publishing fails.
replay_aggregate
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.
replay_with_optional_snapshot
English: Re-exports aggregate reconstruction hooks, replay helpers, results, and failure types.

Type Aliases§

AsyncOutboxLifecycleCompletionError
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
AsyncOutboxLifecycleContext
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
AsyncOutboxLifecycleOperationError
English: Exposes asynchronous single-attempt enqueue tracking, errors, and their short aliases.
OutboxLifecycleCompletionError
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.
OutboxLifecycleContext
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.
OutboxLifecycleOperationError
English: Exposes the single-attempt outbox lifecycle context, its errors, and their short aliases.