Expand description
§WaveSyncDB
Transparent peer-to-peer sync for SeaORM applications.
WaveSyncDB wraps a SeaORM DatabaseConnection via
WaveSyncDb, intercepting write operations (INSERT, UPDATE, DELETE) and replicating
them to peers over libp2p gossipsub. Conflicts are resolved automatically using
Last-Write-Wins (LWW) with hybrid logical clocks.
§Quick start
ⓘ
use sea_orm::*;
use wavesyncdb::WaveSyncDbBuilder;
let db = WaveSyncDbBuilder::new("sqlite:./app.db?mode=rwc", "my-topic")
.build()
.await?;
// Auto-discover #[derive(SyncEntity)] entities
db.get_schema_registry(module_path!().split("::").next().unwrap())
.sync()
.await?;
// Standard SeaORM — sync is transparent
let task = task::ActiveModel { /* ... */ };
task.insert(&db).await?;§Key types
WaveSyncDb— connection wrapper that intercepts writesWaveSyncDbBuilder— configures and builds the connection + P2P engineSchemaBuilder— fluent API for registering entitiesSyncOperation— a serialized write operation sent over the networkChangeNotification— lightweight event emitted after every write
Re-exports§
pub use connection::SchemaBuilder;pub use connection::WaveSyncDb;pub use connection::WaveSyncDbBuilder;pub use messages::ChangeNotification;pub use messages::NodeId;pub use messages::SyncOperation;pub use messages::WriteKind;pub use registry::SyncEntityInfo;pub use registry::TableMeta;pub use registry::TableRegistry;pub use sea_orm;
Modules§
- conflict
- Last-Write-Wins (LWW) conflict resolution.
- connection
- engine
- P2P sync engine powered by libp2p.
- messages
- Core sync message types exchanged between nodes.
- protocol
- Full sync protocol types (work in progress).
- registry
- Table registry for tracking which tables participate in sync.
- sync_
log - Persistent operation log for sync history.
Macros§
- register_
sync_ entity - Enter an element into the plugin registry corresponding to its type.