oxigdal_sync/lib.rs
1//! Multi-device synchronization for OxiGDAL
2//!
3//! This crate provides advanced synchronization capabilities for distributed
4//! geospatial data management, including:
5//!
6//! - **CRDTs (Conflict-free Replicated Data Types)**: LWW-Register, G-Counter,
7//! PN-Counter, OR-Set for conflict-free distributed state
8//! - **Vector Clocks**: Causality tracking for distributed events
9//! - **Operational Transformation**: Concurrent edit reconciliation
10//! - **Multi-device Coordination**: Device discovery and state management
11//! - **Merkle Trees**: Efficient change detection and synchronization
12//! - **Delta Encoding**: Bandwidth-efficient state transfer
13//!
14//! # Example
15//!
16//! ```rust,no_run
17//! use oxigdal_sync::crdt::LwwRegister;
18//! use oxigdal_sync::vector_clock::VectorClock;
19//!
20//! // Create a Last-Write-Wins register with vector clock
21//! let mut register = LwwRegister::new("device-1".to_string(), "initial".to_string());
22//!
23//! // Update with causality tracking
24//! register.set("updated".to_string());
25//! ```
26
27#![deny(unsafe_code)]
28#![warn(missing_docs)]
29
30pub mod coordinator;
31pub mod crdt;
32pub mod delta;
33pub mod error;
34pub mod merkle;
35pub mod ot;
36pub mod vector_clock;
37
38#[cfg(test)]
39mod tests;
40
41pub use error::{SyncError, SyncResult};
42
43/// Device identifier type
44pub type DeviceId = String;
45
46/// Timestamp type for synchronization
47pub type Timestamp = u64;
48
49/// Version vector type for causality tracking
50pub type VersionVector = std::collections::HashMap<DeviceId, Timestamp>;