How loro-dev/loro works
Main Components
a) Core Components:
• CRDT Engine (loro-internal)
• Data Containers (Text, Tree, List, Map)
• Version Control System
• Synchronization Layer
• Storage Layer (KV Store)
b) Integration Layers:
• FFI Layer (loro-ffi)
• WASM Bindings (loro-wasm)
• Language-specific APIs
Architecture Patterns to Highlight
• Modular architecture with clear separation of concerns
• Data flow patterns for synchronization
• Version control mechanisms
• Plugin-based container system
┌─ Client Applications ─────────────────────┐
• JavaScript/Rust/Swift Applications │
• ┬─────────────────────┘
• ↓
┌─ Integration Layer ────────────────────────┐
• ┌─────────────┐ ┌──────────┐ ┌───────┐ │
• loro-wasm │ │ loro-ffi │ │ loro │ │
• ┘ └──────────┘ └───────┘ │
• ┬─────────────────────┘
• ↓
┌─ Core Engine (loro-internal) ─────────────┐
• ┌─────────────┐ ┌──────────┐ ┌─────────┐ │
• CRDT Engine │ │Version │ │Delta │ │
• Control │ │Handling │ │
• ┘ └──────────┘ └─────────┘ │
• ┌─────────────┐ ┌──────────┐ ┌─────────┐ │
• Containers │ │Event │ │State │ │
• Management │ │System │ │Manager │ │
• ┘ └──────────┘ └─────────┘ │
• ┬─────────────────────┘
• ↓
┌─ Storage Layer ───────────────────────────┐
• ┌─────────────┐ ┌─────────────────┐ │
• KV Store │ │ Change Store │ │
• ┘ └─────────────────┘ │
• ┘
Key Relationships
• Bidirectional sync between clients
• Delta propagation paths
• Version control branching
• Container type inheritance
• Event flow patterns
Implementation Details to Note
• The modular crate structure
• WASM bridge architecture
• FFI interface points
• Storage abstraction layer
• Container type system