Expand description
Bidirectional sync between storage mirrors with conflict detection, resolution, and audit.
§Overview
StorageMirrorSync manages synchronization between a local mirror and one or more remote
mirrors. It computes diff plans, resolves conflicts according to configurable policies,
applies operations, and maintains a capped audit log for observability.
§Example
use ipfrs_storage::mirror_sync::{
StorageMirrorSync, MirrorId, SyncItem, MsConflictResolution,
};
let local_id = MirrorId("local".to_string());
let remote_id = MirrorId("remote-1".to_string());
let mut sync = StorageMirrorSync::new(local_id, MsConflictResolution::TakeNewest);
sync.register_mirror(remote_id.clone());
let item = SyncItem::new("Qm1234".to_string(), 100, 0, MirrorId("local".to_string()));
sync.update_local(item);
let plan = sync.diff(&remote_id);
assert_eq!(plan.operations.len(), 1);Structs§
- Mirror
Id - Newtype wrapper for mirror identifiers.
- Mirror
Sync Stats - Aggregate statistics tracked across all
apply_plancalls. - MsSync
Result - Summary of what happened after applying a
SyncPlan. - Storage
Mirror Sync - Bidirectional synchronisation between storage mirrors.
- Sync
Conflict - Describes a conflict between local and remote versions of the same CID.
- Sync
Item - A single item tracked for synchronisation across mirrors.
- Sync
Plan - The result of a
diffcomputation — a list of operations and unresolved conflicts.
Enums§
- Conflict
Type - Classifies the nature of a synchronisation conflict.
- MsConflict
Resolution - Strategy for automatically resolving a sync conflict.
- Sync
Operation - A single operation within a
SyncPlan.
Functions§
- fnv1a_
64 - Computes the FNV-1a 64-bit checksum of a byte slice.