1.2 KiB
1.2 KiB
CRDT Synchronization Protocol Specification
1. Core Synchronization Engine
- Framework: Automerge (Rust Crate)
- Clock Specification: Hybrid Logical Clocks (HLC) combining physical system time with explicit logical sequence counters to prevent clock-skew anomalies across cross-platform endpoints.
2. Register Models & Conflict Resolution
- Task & Note Primitive Fields:
- Properties (Title, Status, Priority Rating, Markdown Body) utilize Last-Write-Wins Element-Set (LWW-Element-Set) registers.
- Conflicts resolve deterministically based on HLC timestamps (hlc_timestamp).
- Project Tree & Order Hierarchy:
- Sequence Ordering uses Fractional Indexing combined with Tree-CRDT rules to eliminate circular references when moving projects offline.
3. Delta Exchange & Wire Protocol
- Transport Layer: libp2p over QUIC with direct UDP transport.
- Delta Sync Workflow:
- Connection established via Noise XK handshake.
- Peers exchange vector clocks containing the local head state hash.
- Missing CRDT delta changesets are compressed, encrypted, and streamed over binary channels.
- Both nodes merge changesets locally into SQLCipher within a single atomic database transaction.