Skip to main content

Module mirror

Module mirror 

Source
Expand description

JSONL <-> SQLite event mirror consistency and recovery.

The JSONL leg is the disaster-recovery source for immutable raw events. This module keeps the boundary small: verify event-set parity, replay acknowledged JSONL rows into SQLite, and provide a mirrored append path for callers that need the JSONL fsync to happen before the SQLite commit.

Structs§

EventMismatch
Difference for an event id present in both stores but with different content.
EventSetParity
Event-set parity report between JSONL and SQLite.
ReplayReport
Replay outcome for JSONL recovery into SQLite.

Enums§

MirrorSingleEventOutcome
In-transaction outcome reported by mirror_single_event_into_sqlite_in_tx.

Constants§

MIRROR_APPEND_PARITY_INVARIANT_RULE_ID
Required contributor rule id documenting that the JSONL <-> SQLite parity invariant (BUILD_SPEC §7) composed into the policy decision for a mirrored append. The mirror refuses a final outcome of Reject or Quarantine so a parity violation cannot enter the durable event set.

Functions§

append_event
Appends one event to JSONL and then commits the same sealed event to SQLite.
append_signed_event
Appends one signed event to JSONL and then commits the same sealed event to SQLite.
mirror_policy_decision_test_allow
Build a PolicyDecision that satisfies the mirror parity invariant gate for append_event / append_signed_event. Intended for tests and fixtures only; production callers MUST compose MIRROR_APPEND_PARITY_INVARIANT_RULE_ID from real parity evidence.
mirror_single_event_into_sqlite
Mirror exactly one already-sealed event into SQLite.
mirror_single_event_into_sqlite_in_tx
In-transaction variant of mirror_single_event_into_sqlite for callers that compose the SQLite-side mirror into a larger atomic cutover transaction (B1: schema v2 cutover, ADR 0033 §1 partial-mutation refusal).
replay_jsonl_into_sqlite
Replays JSONL events missing from SQLite.
verify_event_set_parity
Verifies that JSONL and SQLite contain the same immutable event set.