Storage mode
In one line: a per-component, design-time choice of memory layout and ACID guarantees —
Versioned,SingleVersion, orTransient.
Set on the [Component] attribute and fixed for a given (component name, revision) — to change the mode, bump the [Component] revision; re-using the same revision with a different mode throws InvalidOperationException on reopen, and so does a revision that changes the field layout and the mode (no migration moves data between layouts). Because it lives on the component type, one archetype freely mixes all three. The mode decides whether MVCC/isolation exists at all — and what a write costs.
| Mode | Isolation | Rollback reverts a write |
Durability | Write cost (Zen 4) |
|---|---|---|---|---|
Versioned (default) |
snapshot isolation, MVCC history | yes | zero loss, full ACID | ~250 ns |
SingleVersion |
none — live, last-writer-wins | no by default; yes under the Commit discipline (O(1), staging discarded) |
≤ 1 tick loss (tick-fence WAL) | ~40 ns |
Transient |
none — live | no | none — heap only, gone on crash | ~40 ns |
Measured on Ryzen 9 7950X (Zen 4), .NET 10 Release, hot cache. A
Versionedwrite is ~6× a fast-mode write (copy-on-write: allocate a chunk, copy the value, append a revision, stamp a TSN); reads follow suit — ~80 ns vs ~15 ns (~5×).
📌
Committedis not a fourth mode. It is theCommitdiscipline layered on the byte-identicalSingleVersionlayout — commit-time, zero-loss, atomic durability and O(1) rollback, without a revision chain. It moves three ACID properties at once — isolation, rollback and durability — which is why the enum is named for the commit, not for durability alone.
How it relates
- Snapshot isolation — only
Versionedprovides it. - Durability — mode & discipline — the
Commitdiscipline applies only to theSingleVersionlayout. - Transaction — what "transactional" guarantees per mode.
- Tick fence — where
SingleVersiondurability is realised. - Cluster storage — the batched SoA layout every archetype gets; the mode decides where a component's array sits inside the cluster and whether it is page-cache backed.
In the API
StorageMode— the enum (Versioned/SingleVersion/Transient), set via[Component(StorageMode = ...)].CommitDiscipline— the SingleVersionTickFence⇄Commitescalation.
Learn & use
- Narrative: Guide ch.2 §2 — the decision that matters most
- Reference: Isolation & durability cheat sheet
- Feature detail: Storage modes — Versioned · SingleVersion · Transient · Committed