Expand description
Driving a place’s replica from the server (SPEC-ENGINE §3.4.3–§3.4.4): clone (signed manifest, then every segment, each verified before import, refetched once on a mismatch), tail since the cursor, and push of own events. The server log is the only source of truth: accepted pushes stay pending until the tail delivers them.
Structs§
- Push
Report - What a push did.
- Sync
Report - What a clone or tail did.
- Verifier
- How a place’s events are checked on receive: the Cloud snapshot keys and the signer rules of §3.3.5 (class W worker keys, class A Cloud keys).
Traits§
- Place
Api - The routes a replica needs.
crate::transport::CloudClientimplements it; tests use an in-memory server.
Functions§
- clone_
place - Clone
placeinto an empty replica: verified manifest, then every segment. A segment that fails its checks is fetched once more; a second failure stops the clone (segment_unavailable) with nothing of it stored. A snapshot revision that rotated out meanwhile (404 not_found, only the latest 2 are kept) restarts the clone once from a fresh manifest. - deletions
- Deletions while the month’s transfer is used up (E2E-FINAL). E4 then
answers only the
purgetombstones of purges still waiting for acks, withnext_since=since(deleting is protected capacity). They fold on top of the replica’s graph without being stored, so the cursor never moves past events not received yet, and the bodies they purge are shredded at once; the caller denies, removes local text and acks.None: the answer was an ordinary page (it moved on, or held other events), so the quota is back and a full sync is due. - push_
acks - Send signed purge acks alone (an ack-only E5 push, never metered).
- push_
pending - Push the replica’s pending own events in batches of
push::MAX_BATCH, with the signed purge acks riding on the first request (one is sent even without events). Failed events leave the pending queue; everything else stays pending until the tail delivers it.report.ackedis true when the acks reached the place. - reconcile
- Failover reconcile (SPEC-ENGINE §3.4.4, RESOLUTIONS R48), once per
trigger: re-push the kept own batches unchanged (the place answers
duplicatefor what it still holds and logs the lost ones again), re-tail from the lowestseqreceived in the last 24 h (or the place’shead_seqafter a restore), drop local rows whoseseqcame back with another event or not at all, refold, then take the new epoch. - tail
- Fetch the log since the replica’s cursor, page by page, store what
verifies (and what does not, marked
sig_invalid), settle own pending events the log now holds, and refold.