Skip to main content

Module ingest_rules

Module ingest_rules 

Source
Expand description

The ingest rules. See the crate documentation for what each covers.

Each rule is an async function taking impl AsyncFn() -> F, how to make a fixture rather than a fixture, as in the event-store family, and returning Result<RuleOutcome, Violation>.

§What no rule here does

Decode a payload (SY-35). Events are compared whole, identity, recorded time and the opaque bytes, and never parsed.

Assert a local position it did not read back. The specification permits gaps, so every local position compared is one the store assigned. The literal positions below are origin positions: facts a peer supplies.

Locate an event by identity, except VT-5’s. The other rules find what they wrote by its distinct opaque bytes, so a store that re-mints on ingest fails VT-5’s rule and only that one.

Assume an identity the store did not state. Each rule awaits the store’s store_id before it arranges anything, and a failed read is a violation of the rule’s own clause rather than a reason to carry on.

Functions§

an_unheld_own_identity_stops_the_ingest
SY-38: an event claiming the store’s own identity at a position the store did not hold when the call began refuses the whole call as [IngestError::UnheldOwnIdentity], class [FailureClass::Stop], and writes nothing. A held own identity is a re-delivery, and a skip.
bulk_ingest_is_idempotent_in_bounded_round_trips
SY-14: a pulled batch lands in one ingest call, however many of its events the store already holds, and the same call again changes nothing. With VT-24 on the ingest path: the call is MIN_SUPPORTED_EVENTS_PER_BATCH foreign events, the push the minimum peer declares it takes, and every store takes it.
dedupe_reaches_identity_without_decoding
SY-12: a re-delivery is decided on the event’s identity alone, which the store reaches without decoding a byte of the payload. With SY-11’s store half: a group that was wholly a re-delivery writes no compensation.
directional_merge_rules_compose
SY-10: the runner may give each direction of one edge its own merge rule, and a store takes what each direction hands it, judging nothing itself.
ingest_group_is_atomic_under_a_mid_group_fault
SY-30: an [IngestGroup] lands whole or not at all, even when the store fails between two of its rows.
ingest_holds_the_call_to_its_tags_per_batch_ceiling
VT-36 on the ingest path: a store that declares a tags-per-batch ceiling holds the whole call to it, every foreign event and every compensation event of every group counted together, and refuses a call one tag over as [IngestError::ExceedsStoreLimit] naming StoreLimit::TagsPerBatch and the call’s total, class [FailureClass::Split], with nothing written (ADR-0100). SY-18 is why the refusal has to be a true one.
ingest_preserves_origin_identity
VT-5: an ingested event keeps the EventId its origin minted.
ingest_preserves_the_recorded_time
VT-9: an ingested event keeps the RecordedAt its origin carried, unchanged; a store stamps only what it accepts from a local append.
ingest_validates_every_event_not_the_head
SY-18: a store holds every event an ingest writes to the per-event ceilings it declares, not the head of each group, and an event over one refuses the whole call.
ingested_events_land_above_the_local_head
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.
only_the_adjudicator_compensates
SY-7: a compensation is written only by the store the assignment names the fact family’s adjudicator, and filed under that store’s own identity, which is how a log records who authored it.