Skip to main content

Module sync

Module sync 

Source
Expand description

Reconcile two Stores. Any store can be a sync peer.

Sync reads through the replication surface (list_raw / get_raw), so it sees tombstones. For a key held by both sides it uses each record’s bounded ancestors list (spec §3.4) to tell “one side is behind” (overwrite it) from “the sides diverged”. Diverged tombstones converge on the higher revision. A tombstone against a live edit is a conflict. Two diverged live records take the class-aware merge: append-only kinds union, and structured/opaque divergences surface as conflicts. sync_with_ancestry 3-way-merges structured bodies against their real common ancestor when an AncestryStore retains it; sync uses an empty base (ADR 0016).

Structs§

SyncConflict
A divergence that could not be auto-merged and needs caller/CLI resolution: an unmergeable body divergence, or a delete (one side a tombstone) against a concurrent edit. Neither side is written.
SyncReport
What a sync run did.

Functions§

sync
Reconcile stores a and b. After a run with no conflicts that did not exhaust [MAX_SYNC_PASSES], both stores hold the same record (live or tombstone) for every key.
sync_with_ancestry
As sync, but 3-way-merges divergent Structured bodies against their real common ancestor when one is available. ancestry is a content-addressed store of past bodies keyed by revision hash (see AncestryStore): when two records diverge from a shared parent revision whose body it holds, that body is the merge base; otherwise sync falls back to the empty base (ADR 0016).