Skip to main content

sync

Function sync 

Source
pub async fn sync(a: &dyn Store, b: &dyn Store) -> Result<SyncReport>
Expand description

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.

Check SyncReport::converged as well as conflicts: an exhausted run reports the still-racing keys in SyncReport::unconverged, and treating its empty conflicts list as “in sync” would be wrong (gonzalo#290).

Stores need not be quiescent. A single pass can lose a write that lands in the read→merge→write window (the OCC put_raw returns Conflict, or NotFound when the key was purged meanwhile); sync re-runs the pass until one completes without any such race (a fixpoint), bounded by [MAX_SYNC_PASSES] so continuous concurrent writes can’t livelock it.