Module rules
Expand description
The projection conformance rules.
Each rule is an independent async function taking impl AsyncFn() -> F: not
a fixture, but how to make one. A rule that can call open() twice can
make two genuinely isolated projection stores, which is what
commit_rejects_a_foreign_batch needs and what no meta-test over the
testkit’s own fixture could substitute for.
They are public so an adapter can call one directly when debugging a single
failure, exactly as crate::rules is.
Functions§
- batch_
reads_ reflect_ pending_ writes - An open batch can be read through, and sees its own pending writes.
- commit_
accepts_ a_ position_ the_ batch_ did_ not_ write - A commit may name a position no applied write occupies.
- commit_
advances_ the_ checkpoint - A commit moves the projection’s checkpoint to the position it was given.
- commit_
is_ atomic_ with_ the_ read_ model - The read-model write and the checkpoint write become durable together, or neither does.
- commit_
rejects_ a_ foreign_ batch - A batch begun on one store instance is rejected by another, and neither store moves.
- commit_
rejects_ a_ regressing_ position - A commit naming a position strictly below the current checkpoint is refused, and neither half moves.
- committed_
rows_ and_ checkpoint_ survive_ a_ reopen - A committed read-model row and its checkpoint are both still there after every handle is dropped and the fixture reopens its storage.
- distinct_
projections_ advance_ independently - One
commitadvances exactly oneProjectionId. - dropped_
batch_ leaves_ store_ usable - A batch dropped bare rolls back and leaves the store usable.
- failed_
commit_ leaves_ both_ unchanged - A
committhat reported failure left the read model and the checkpoint exactly as they were. - fresh_
projection_ has_ no_ checkpoint - A projection the store has never seen reads back as
Checkpoint::NeverRun. - projection_
ids_ round_ trip_ by_ bytes - Every id
ProjectionId::newaccepts names its own checkpoint, kept by its exact bytes throughcommit,checkpointandreset. - rebuild_
is_ chunk_ size_ invariant - A rebuild produces the same read model however it is chunked.
- rebuilding_
is_ distinguishable_ from_ live - A projection being rebuilt is distinguishable from one serving live.
- refused_
reset_ changes_ nothing - A refused
resetleaves the read model and the checkpoint exactly as they were, and is never reported as success. - reset_
clears_ rows_ and_ checkpoint_ together - A
resetapplies the caller’s batch and returns the checkpoint toCheckpoint::NeverRunas one unit of work. - reset_
is_ not_ commit_ at_ first resetis distinguishable fromcommit(empty_batch, id, FIRST, Live), in the checkpoint and in the replay that follows it.- reset_
is_ scoped_ to_ one_ projection - A
resetmoves exactly one(store, ProjectionId)pair. - rollback_
leaves_ both_ unchanged - An explicit
rollbackleaves the read model and the checkpoint exactly as the last successful commit left them.