Skip to main content

watermark_advances_transactionally_with_a_read_model

Function watermark_advances_transactionally_with_a_read_model 

Source
pub async fn watermark_advances_transactionally_with_a_read_model<F: ProjectionFixture>(
    open: impl AsyncFn() -> F,
) -> Result<RuleOutcome, Violation>
Expand description

SY-31. A runner’s per-peer watermark is kept through the projection port, under the reserved id, in the same commit as a read model.

The rule appends two groups to a local log and syncs an edge with a hub, then commits the edge’s watermark through the fixture’s store in a batch carrying one probe row. Through a fresh handle it requires:

  1. the row and the watermark both, so they landed in one commit;
  2. an edge restored from that watermark to push nothing more;
  3. after a third group and a second edge, to a spoke, committed with a row of its own, each peer’s watermark its own;
  4. a hub watermark below the kept one refused as CommitError::CheckpointRegression, with neither its row nor the watermark changed.

§Rejects

tests/wrong_watermark_stores.rs carries four projection stores, each wrong only for a sync/ id: one that refuses the reserved prefix as an application id it does not accept, one that keeps sync ids in its handle rather than its store, one that keys every peer’s watermark under the bare prefix, and one that upserts a watermark into a side table without the port’s regression check.

§Errors

A Violation of SY-31 if the fixture declines a second handle, if the store refuses or loses a watermark, keeps it apart from its batch, shares it between peers or lets it move backwards, or if the reference edge fails to sync.