Skip to main content

Module mirror_sync

Module mirror_sync 

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

MirrorId
Newtype wrapper for mirror identifiers.
MirrorSyncStats
Aggregate statistics tracked across all apply_plan calls.
MsSyncResult
Summary of what happened after applying a SyncPlan.
StorageMirrorSync
Bidirectional synchronisation between storage mirrors.
SyncConflict
Describes a conflict between local and remote versions of the same CID.
SyncItem
A single item tracked for synchronisation across mirrors.
SyncPlan
The result of a diff computation — a list of operations and unresolved conflicts.

Enums§

ConflictType
Classifies the nature of a synchronisation conflict.
MsConflictResolution
Strategy for automatically resolving a sync conflict.
SyncOperation
A single operation within a SyncPlan.

Functions§

fnv1a_64
Computes the FNV-1a 64-bit checksum of a byte slice.