Skip to main content

ingested_events_land_above_the_local_head

Function ingested_events_land_above_the_local_head 

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

SY-5: an ingested event, and its compensation, land at the tail, above every position assigned before the call, and the log below the old head is unchanged.

Three local events are appended. One group then arrives from an origin that numbered its events 1 and 2, below the local head, which is what tempts a merge, with one compensation event. Read back, every event at or below the old head is what was there before, whole, and each foreign event and the compensation is held once, above it. Events are found by their distinct bytes, never by identity.

§Rejects

An order-preserving merge: a store that inserts an ingested event where its origin numbered it and renumbers what follows, so a projection that had read past that position never sees it. tests/wrong_ingest_stores.rs carries it.

§Errors

A Violation of SY-5 if the store refuses a write, rewrites the log below the old head, or holds a written event other than once above it.