Expand description
§EntiDB Sync Engine
Sync state machine and engine for EntiDB.
This crate provides:
- Sync state machine (idle → pulling → pushing → synced)
- Cursor management
- Conflict detection and resolution
- Retry with exponential backoff
- HTTP transport abstraction
- Database-backed sync applier
§Architecture
The sync engine implements a pull-then-push synchronization model:
- Pull remote changes first (server is authoritative)
- Apply remote changes locally
- Push local changes to server
The sync server uses the same EntiDB core as clients, ensuring consistent storage semantics everywhere.
§Key Invariants
- Server is authoritative
- Pull always happens before push
- Operations are idempotent
- Sync operations are atomic per batch
- Server uses EntiDB for persistence (no external database)
Structs§
- Database
Applier - A sync applier backed by an EntiDB database.
- Http
Transport - HTTP-based sync transport.
- Loopback
Client - A loopback HTTP client that routes requests directly to a sync server.
- Memory
Sync Applier - An in-memory sync applier for testing.
- Mock
Transport - A mock transport for testing.
- Retry
Config - Configuration for retry behavior.
- Sync
Config - Configuration for sync operations.
- Sync
Cycle Result - Result of a sync cycle.
- Sync
Engine - The sync engine manages synchronization with a remote server.
- Sync
Stats - Statistics about sync operations.
Enums§
- Sync
Error - Errors that can occur during sync operations.
- Sync
Request - Request types for sync operations.
- Sync
Response - Response types for sync operations.
- Sync
State - The current state of the sync engine.
Traits§
- Cbor
Decode - Trait for CBOR decoding.
- Cbor
Encode - Trait for CBOR encoding.
- Http
Client - HTTP client abstraction.
- Loopback
Server - Trait for servers that can handle loopback requests.
- Sync
Applier - Callback for applying remote operations to the local database.
- Sync
Transport - A sync transport handles network communication with the sync server.
Type Aliases§
- Sync
Result - Result type for sync operations.