MDCS Delta - Delta-State CRDT Framework
This crate implements the δ-CRDT (delta-state CRDT) framework for efficient synchronization.
Overview
The δ-CRDT framework provides:
- Delta-mutators (
mδ): Functions that compute minimal state changes - Delta buffers: Grouping and batching deltas for transmission
- Anti-entropy Algorithm 1: Convergence protocol from the δ-CRDT paper
Key Property
For any delta-mutator mδ:
m(X) = X ⊔ mδ(X)
This means the full mutation result can be reconstructed by joining the delta with the original state.
Algorithm 1: Convergence Mode
On local mutation m:
d = mδ(X) // compute delta
X = X ⊔ d // apply to local state
D.push(d) // buffer for sending
On send to peer j:
send D[acked[j]..] to j
On receive delta d from peer i:
X = X ⊔ d // apply (idempotent!)
send ack(seq) to i
Modules
buffer
DeltaBuffer<D>: Buffering deltas with grouping and compactionDeltaReplica<S, D>: A replica with integrated delta managementAckTracker: Tracking acknowledgments from peers
mutators
gset: Delta-mutators for GSet (grow-only set)orset: Delta-mutators for ORSet (observed-remove set)
anti_entropy
AntiEntropyCluster<S>: Multi-replica cluster with simulated networkNetworkSimulator<D>: Simulates loss, duplication, reorderingNetworkConfig: Configuration for network simulation
Usage
use DeltaReplica;
use GSet;
// Create a replica
let mut replica: = new;
// Mutate using delta-mutator
replica.mutate;
assert!;
Testing Convergence
The crate includes comprehensive tests proving convergence under:
- Message loss: Handled by retransmission
- Message duplication: Handled by idempotence (a ⊔ a = a)
- Message reordering: Handled by commutativity (a ⊔ b = b ⊔ a)
Run tests with:
References
- Almeida, P. S., Shoker, A., & Baquero, C. (2018). Delta state replicated data types. Journal of Parallel and Distributed Computing, 111, 162-173.