Expand description
§mdcs-compaction
Compaction and stability subsystem for the MDCS (Merkle-Delta CRDT Store).
This crate provides:
- Snapshotting: Serialize full CRDT state at stable frontiers
- DAG pruning: Remove nodes older than the last snapshot
- Stability monitoring: Track delivered and stable frontiers
- Version vectors: Compact representation of causal context
§Architecture
The compaction subsystem ensures bounded metadata growth by:
- Tracking which updates have been durably replicated (stability)
- Creating periodic snapshots at stable points
- Pruning DAG history before the snapshot root
- Preventing resurrection of deleted items
§Example
ⓘ
use mdcs_compaction::{StabilityMonitor, SnapshotManager, PruningPolicy};
// Create a stability monitor
let mut monitor = StabilityMonitor::new("replica_1");
// Track frontier updates from peers
monitor.update_peer_frontier("replica_2", frontier_2);
monitor.update_peer_frontier("replica_3", frontier_3);
// Check if a node is stable (delivered to all tracked peers)
if monitor.is_stable(&node_cid) {
// Safe to compact
}Modules§
- compactor 🔒
- High-level compaction orchestrator.
- pruning 🔒
- DAG pruning for bounded history growth.
- snapshot 🔒
- Snapshot management for CRDT state persistence.
- stability 🔒
- Stability monitoring for safe compaction.
- version_
vector 🔒 - Version vector for compact causal context representation.
Structs§
- Compaction
Config - Configuration for the compactor.
- Compaction
Stats - Statistics about compaction operations.
- Compactor
- High-level compactor that orchestrates all compaction operations.
- Frontier
Update - Update about a peer’s frontier.
- Pruner
- Pruner for removing old DAG nodes.
- Pruning
Policy - Policy for DAG pruning decisions.
- Pruning
Result - Result of a pruning operation.
- Pruning
Verifier - Verification utilities for pruning safety.
- Snapshot
- A snapshot of CRDT state at a specific point in causal history.
- Snapshot
Manager - Manages snapshot creation and retrieval.
- Stability
Config - Configuration for stability monitoring.
- Stability
Monitor - Monitors stability across replicas for safe compaction decisions.
- Vector
Entry - A single entry in a version vector.
- Version
Vector - A version vector tracking the frontier of seen updates per replica.
Enums§
- Compaction
Error - Errors that can occur during compaction.
- Snapshot
Error - Errors that can occur during snapshot operations.
- Stability
State - State of stability tracking for a single item.
Traits§
- Prunable
Store - Extension trait for stores that support node removal.