Expand description
Synchronization traits: the read/write faces of a replica and the cursors they exchange.
LogProcessor— write side:applyan entry at(peer, index). Multi-writer, idempotent.LogSource— read side:read_sinceto pull,cursors/watch_cursorsto publish progress.
A store that is both is a Replica (the SQL oplog). A file log reads any
origin but writes only its own (FileLogSink), so it’s a
FileLogReplica — the type-level form of “only the originating device
writes its own log”. Both faces speak PeerCursors, a per-origin version
vector. The convergence drivers that consume these traits come later.
Structs§
- Applied
- Outcome of
LogProcessor::apply.
Enums§
- Cursors
Event - An event from
watch_cursors. - Sync
Error - The sync subsystem’s error: reading a log (
LogSource), applying entries (LogProcessor), or writing the local log (FileLogSink). Backends erase their own errors intoSyncError::Backend, so the object-safe traits share one fixed error type instead of an associated one.
Traits§
- File
LogPuller - Synchronous reader over the segment directories — one per origin. Sync
because it decodes local files; an adapter pairs it with a watch/poll loop to
present it as an async
LogSource. - File
LogReplica - A file log as a replica: multi-reader (
LogSource), single-writer (FileLogSink). The single-writer counterpart toReplica; owned by its mirror, not shared. - File
LogSink - Write side of a file log: append to your own origin only. No method writes a foreign origin — that’s the single-writer invariant. The caller supplies each entry’s index (the oplog assigns them; the file log follows).
- HasCursors
- Snapshot or watch a replica’s cursor vector — the shared base of
LogProcessorandLogSource. - LogProcessor
- The apply target of replication: absorbs entries addressed by
(peer, index). - LogSource
- The pull side of replication: publish progress as cursors, hand back entries past a position.
- Replica
- A full replica: readable (
LogSource) and writable for any origin (LogProcessor). The SQL oplog is this, so one type serves, relays, and merges. ContrastFileLogReplica, which writes only its own origin.
Type Aliases§
- Cursor
Stream - Stream from
watch_cursors; ending means the watch closed. - Peer
Cursors - Per-origin position:
peer id → next entry index. The value for a peer is what to passread_sincefor the next entry; an absent key means0.