Skip to main content

Module cqrs

Module cqrs 

Source
Expand description

CQRS + Event Sourcing pattern.

CqrsPattern wires up the four moving parts of a typical command-query stack:

  1. A command gateway actor that owns one crate::AggregateRoot instance per aggregate id and persists events through the configured atomr_persistence::Journal.
  2. A repository handle that callers use to dispatch commands.
  3. Zero or more readers — async tasks that follow the atomr_persistence_query::ReadJournal, decode events with the user-supplied codec, and fold them into projection state.
  4. Extension hooks — pre-handler interceptors (validation, authorization), post-persist event listeners, and async event taps that bridge to atomr_streams / external systems.

See CqrsPattern::builder for the entry point.

Re-exports§

pub use audit::AuditLog;
pub use audit::AuditProjection;

Modules§

audit
AuditLog — built-in super::Reader that retains a ring of every event it sees, useful for compliance views and “what happened recently” UIs.

Structs§

CqrsBuilder
Fluent builder for a CQRS instance.
CqrsHandles
Strongly-typed handles into a materialized CQRS instance.
CqrsPattern
Public, zero-sized handle to the CQRS pattern. Use CqrsPattern::builder to start configuring an instance.
CqrsTopology
Inspectable description of a CQRS topology — actors not yet spawned, readers not yet running. Call Topology::materialize to bring it to life.
EventCodecRegistry
Manifest -> decoder map plus an optional catch-all decoder.
ProjectionHandle
Read-only access to a projection’s current state and offset.

Enums§

ReaderFilter
What stream of events the reader subscribes to. Selected via Reader::filter; defaults to ReaderFilter::All.

Traits§

Reader
Fold journal events into a projection.

Functions§

schedule_command
Send cmd to repo after delay. Returns immediately; the dispatch happens in a detached tokio task. Errors from the repo are logged at warn level — callers who care about the outcome should construct their own scheduling.