pub struct SyncMetadata {
pub peer_pubkey: PublicKey,
pub sync_established: String,
pub last_sync_attempt: String,
pub last_successful_sync: Option<String>,
pub successful_sync_count: u64,
pub failed_sync_count: u64,
pub total_entries_synced: u64,
pub total_bytes_synced: u64,
pub average_sync_duration_ms: f64,
pub synced_trees: Vec<ID>,
}Expand description
Metadata about synchronization operations for a peer.
This tracks overall sync statistics and health information for a peer relationship across all trees.
Fields§
§peer_pubkey: PublicKeyThe peer’s public key
sync_established: StringTimestamp when sync relationship was first established
last_sync_attempt: StringTimestamp of the last sync attempt (successful or failed)
last_successful_sync: Option<String>Timestamp of the last successful sync
successful_sync_count: u64Total number of successful sync operations
failed_sync_count: u64Total number of failed sync operations
total_entries_synced: u64Total number of entries synchronized
total_bytes_synced: u64Estimated total bytes synchronized
average_sync_duration_ms: f64Average sync duration in milliseconds
synced_trees: Vec<ID>List of trees being synchronized with this peer
Implementations§
Source§impl SyncMetadata
impl SyncMetadata
Sourcepub fn new(peer_pubkey: PublicKey, clock: &dyn Clock) -> Self
pub fn new(peer_pubkey: PublicKey, clock: &dyn Clock) -> Self
Create new sync metadata for a peer.
§Arguments
peer_pubkey- The peer’s public keyclock- The time provider for timestamps
Sourcepub fn record_successful_sync(
&mut self,
entries_count: u64,
bytes: u64,
duration_ms: f64,
clock: &dyn Clock,
)
pub fn record_successful_sync( &mut self, entries_count: u64, bytes: u64, duration_ms: f64, clock: &dyn Clock, )
Record a successful sync operation.
§Arguments
entries_count- Number of entries syncedbytes- Estimated bytes transferredduration_ms- Duration of sync in millisecondsclock- The time provider for timestamps
Sourcepub fn record_failed_sync(&mut self, clock: &dyn Clock)
pub fn record_failed_sync(&mut self, clock: &dyn Clock)
Sourcepub fn add_synced_tree(&mut self, tree_id: ID)
pub fn add_synced_tree(&mut self, tree_id: ID)
Add a tree to the list of synced trees if not already present.
Sourcepub fn remove_synced_tree(&mut self, tree_id: &ID)
pub fn remove_synced_tree(&mut self, tree_id: &ID)
Remove a tree from the list of synced trees.
Sourcepub fn sync_success_rate(&self) -> f64
pub fn sync_success_rate(&self) -> f64
Calculate the success rate of sync operations.
Trait Implementations§
Source§impl Clone for SyncMetadata
impl Clone for SyncMetadata
Source§fn clone(&self) -> SyncMetadata
fn clone(&self) -> SyncMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyncMetadata
impl Debug for SyncMetadata
Source§impl<'de> Deserialize<'de> for SyncMetadata
impl<'de> Deserialize<'de> for SyncMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SyncMetadata
impl PartialEq for SyncMetadata
Source§impl Serialize for SyncMetadata
impl Serialize for SyncMetadata
impl StructuralPartialEq for SyncMetadata
Auto Trait Implementations§
impl Freeze for SyncMetadata
impl RefUnwindSafe for SyncMetadata
impl Send for SyncMetadata
impl Sync for SyncMetadata
impl Unpin for SyncMetadata
impl UnwindSafe for SyncMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more