#[non_exhaustive]pub enum Checkpoint {
NeverRun,
Live {
through: SequencePosition,
},
Rebuilding {
through: SequencePosition,
},
}Expand description
Where a projection has been brought to, and whether its rows can be trusted.
An enum rather than (Option<SequencePosition>, bool) because the tuple can
spell (None, true) — authoritative, never run — which means nothing. That
is this crate’s “illegal states are unrepresentable” line, applied where a
reader would otherwise write if let Some(p) = checkpoint and get it wrong.
A bare Option<SequencePosition>, the weaker alternative, cannot distinguish
a rebuild in flight from an authoritative read model at all.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NeverRun
Never run, or reset, or rebuilding with nothing committed yet.
Distinct from a checkpoint at the first position: an operator who
substitutes commit(empty_batch, id, FIRST, _) for “never run” makes a
runner resume after event 1, which is then skipped permanently and
silently.
Live
Considered through through, and the read model is authoritative.
Fields
through: SequencePositionThe position this projection has considered up to. A runner resumes strictly after it.
Rebuilding
A rebuild is in flight, considered through through. Rows are not
authoritative.
Fields
through: SequencePositionThe position the rebuild has considered up to.