Expand description
Core types for entity snapshotting.
A repo with #[es_repo(snapshot)] persists, in the same statement as the
events it appends, an author-defined state S (the fold of events
1..=k) into <tbl>_snapshots. Hydration then loads S plus only the
events after k in one round trip.
Structs§
- Snapshot
Record - A persisted snapshot as loaded: the state plus the metadata of the events it summarises.
Enums§
- NoSnapshot
- The default
SofEntityEvents<E, S>: this entity has no snapshot. - Replay
- One item of an entity’s replay. The snapshot, when present, is the FIRST
item in forward order and the LAST item in reverse order. Deliberately
exhaustive — do not add
#[non_exhaustive].
Constants§
- NO_
SNAPSHOT_ FINGERPRINT - Matches no stored snapshot; binds on full-history loads and is
NoSnapshot’s fingerprint.
Traits§
- EsSnapshot
- Implemented by
#[derive(EsSnapshot)]for user state types and by hand forNoSnapshot. - Guard
Without Snapshot Clause - Reached by
idempotency_guard!when a stream yieldsReplay::Snapshotbut the guard has nosnapshot:clause. OnlyNoSnapshot(andSnapshotRecord<NoSnapshot>) implement it, so on a real snapshot this is a compile error with the message below. - Head
Snapshot - Implemented by every entity whose repo enables
snapshot. - Into
Replay - Normalises
idempotency_guard!input: a plain&Estream (today’s call sites) and areplay()stream both becomeReplay. Do not implement for other types.