Skip to content

Cratis write-side consistency: map DCB and stream checks

Cratis Chronicle protects a decision with concurrency scopes: conditions checked atomically with an append. If you know Dynamic Consistency Boundary (DCB), stream-version checks or aggregates, use this page to translate those ideas before choosing an API. For product comparisons rather than this terminology map, see event sourcing in .NET and on the JVM.

Chronicle supports DCB-style decision models and append conditions within its own event-source model. It is not a DCB event store and does not implement the DCB specification’s API. In particular, custom tags used to query events are not the predicates used to guard appends.

DCB Chronicle
One event can carry tags for several entities One event belongs to exactly one event source. A fact about two entities is one event for each, appended together in one atomic append
Tags select the events a decision depends on Guards select event types and routing metadata: event source id, event source type, event stream type and event stream id. Each routing dimension has one value per event
A query item combines event types and tags A concurrency scope combines optional event-type and routing filters
An append condition holds one or more query items and a position Each scope carries its own position and filter. Any violation rejects the whole append
Several items on the same entity can stay separate The .NET client retains separate predicates when the kernel supports them; otherwise it can merge read guards conservatively, causing extra conflicts

Custom tags on a Chronicle event are stored and filterable, but they do not take part in a consistency check.

If you come from a stream-version check or an aggregate

Section titled “If you come from a stream-version check or an aggregate”
You know In Cratis
An expected version or revision on append to one stream An explicit concurrency scope with the sequence number you saw. In Arc, EventsWithConcurrencyScopes carries the revision from the client
An aggregate that loads its events, decides and appends A .NET Arc aggregate root. It guards the event types it handles on its event source
A decision model built from the events a decision needs A decision read: an admitted projection or reducer read with a position captured before it folds. Arc read protection On arranges this for admitted read-model parameters
Guarding a decision across entities selected by tag Read each entity by key and guard one atomic append. Custom-tag queries do not create append conditions
A unique key or index A constraint, enforced for every writer without a read
Rejecting duplicate client tokens A [Unique] constraint on the token. It rejects reuse; it does not return a cached response

Check your tool’s own documentation for what it guards and what it does not. This page does not describe other products’ consistency features.

In DCB and other tools In Cratis
Tag used in a condition A routing filter: event source id, event source type, event stream type or event stream id. Not a Chronicle custom tag
Decision model Decision read, or a read-model parameter under read protection On
Query item One concurrency scope, or the guard one read produces
Append condition Guard
Aggregate or consistency boundary Aggregate root, or an event source definition whose stream is guarded as a whole

With Arc read protection On, a command’s admitted read-model parameters become protected reads. Unsupported reads are refused rather than silently running unguarded. This avoids having each command manually enroll its decision reads, but it does not protect other writers or external state.

For uniqueness or once-only facts, use a kernel constraint instead of reading first. It is checked for every writer. For state-based rules, event source definitions declare routes and concurrency boundaries; per-stream read models let a rule read one selected period of an entity’s history. Other enrolled reads or declared scopes can widen that guard.

Closing a stream prevents later appends to that stream. It does not make earlier history immune to revision or redaction.

  • Give one event several event source IDs. Custom tags can describe several entities, but are not consistency predicates.
  • Use custom tags in an append condition.
  • Derive a decision-read guard from a projection that joins entities or uses a key other than the event source. Such reads are refused.
  • Guard one decision across event sequences.

A position-only scope detects appends, not revisions or redactions of earlier history. The .NET decision-read path additionally captures a history-mutation marker when supplied by the kernel, and a change to that marker invalidates the read’s guard. Do not assume that protection for hand-built scopes or other clients. See the concurrency contract for the distinction.

Start with Keeping decisions correct to choose a mechanism for your rule. For DCB-specific modeling, continue to Dynamic Consistency Boundary in Chronicle.

Before combining reads or writing explicit scopes, read How guards are derived. The write-side consistency learning path then takes you through implementation.