Module replication

Module replication 

Source
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§

ReplicationManager
Replication manager for coordinating multiple replicators
ReplicationState
Replication state for tracking sync progress
Replicator
Block replicator for syncing between stores
SyncResult
Result of a synchronization operation

Enums§

ConflictStrategy
Conflict resolution strategy
SyncStrategy
Synchronization strategy