technology / sync
Sync
A folder in iCloud Drive, OneDrive or similar acts as the transport for syncing slides between devices. No server of ours is involved.
design
A layout that cannot conflict
Cloud sync services only move files, so two devices writing the same file create conflict copies. AiiB gives each device its own files to write.
- Single writer
Each device appends only to its own file. No two devices write the same file, so conflict copies cannot occur.
- CRDT merge
Updates are merged by CRDT and converge to the same result regardless of arrival order.
- Offline edits
If both devices are edited offline, they reach the same content once connected.
- Separate lineages stay separate
A chain identifies whether a file continues the same document. Different chains are not merged, and the interface says so.
log file
Sync files
Append-only logs, separated by document and device, live in the folder you choose.
- writer
- One file per device, append-only
- integrity
- Per-frame checksums. Nothing past a truncated end or damaged frame is read
- detection
- OS file notifications (notify)
generations
Generations
Append-only files would grow forever, so at a certain size they are rewritten into a new generation holding the current state.
- replace
- Written to a temporary file and swapped in with rename, so readers never see a partial file
- delete
- Deletions reach other devices through a separate file, and the user confirms whether to apply them