Expand description
Block replication and synchronization
Provides protocols for syncing blocks between stores:
- Incremental sync (delta only)
- Full sync
- Conflict resolution
- Bi-directional replication
§Example
ⓘ
use ipfrs_storage::{Replicator, SyncStrategy, SledBlockStore, BlockStoreConfig};
use std::sync::Arc;
use std::path::PathBuf;
// Create source and target stores
let source = Arc::new(SledBlockStore::new(BlockStoreConfig {
path: PathBuf::from(".ipfrs/source"),
cache_size: 100 * 1024 * 1024,
})?);
let target = Arc::new(SledBlockStore::new(BlockStoreConfig {
path: PathBuf::from(".ipfrs/target"),
cache_size: 100 * 1024 * 1024,
})?);
// Create replicator
let replicator = Replicator::new(source, target);
// Perform incremental sync
let result = replicator.sync(SyncStrategy::Incremental, None).await?;
println!("Synced {} blocks ({} bytes)", result.blocks_synced, result.bytes_synced);Structs§
- Replication
Manager - Replication manager for coordinating multiple replicators
- Replication
State - Replication state for tracking sync progress
- Replicator
- Block replicator for syncing between stores
- Sync
Result - Result of a synchronization operation
Enums§
- Conflict
Strategy - Conflict resolution strategy
- Sync
Strategy - Synchronization strategy