2 releases
| 2.0.0-alpha.3 | Jan 3, 2026 |
|---|---|
| 2.0.0-alpha.1 | Dec 25, 2025 |
#217 in Database implementations
790KB
16K
SLoC
entidb_sync_engine
Sync state machine and engine for EntiDB.
Overview
This crate implements the synchronization state machine for EntiDB's offline-first architecture. It manages the pull-then-push protocol and handles conflict detection.
Features
- State machine: Robust sync lifecycle (idle → connecting → pulling → pushing → synced)
- Pull-then-push: Always pull remote changes before pushing local changes
- Cursor tracking: Maintains server and local cursors for incremental sync
- Conflict detection: Identifies concurrent modifications for resolution
Sync Flow
┌─────────┐ ┌───────────┐ ┌─────────┐ ┌────────┐
│ Idle │────▶│ Connecting│────▶│ Pulling │────▶│ Pushing│
└─────────┘ └───────────┘ └─────────┘ └────────┘
▲ │
└──────────────────────────────────────────────────┘
(synced)
Usage
use entidb_sync_engine::SyncEngine;
let engine = SyncEngine::new(database, config);
engine.sync().await?;
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Dependencies
~10–14MB
~168K SLoC