pub struct PeerSyncState {
pub last_received_timestamp: Timestamp,
pub sync_count: u32,
pub bytes_sent: u64,
pub bytes_received: u64,
/* private fields */
}Expand description
Tracks the sync state with a specific peer
Fields§
§last_received_timestamp: TimestampLast timestamp we received from this peer
sync_count: u32Number of successful syncs
bytes_sent: u64Bytes sent to this peer
bytes_received: u64Bytes received from this peer
Implementations§
Source§impl PeerSyncState
impl PeerSyncState
Sourcepub fn mark_sent(&mut self, key: &str, timestamp: Timestamp)
pub fn mark_sent(&mut self, key: &str, timestamp: Timestamp)
Record that we sent a key at a timestamp
Sourcepub fn last_sent_timestamp(&self, key: &str) -> Option<Timestamp>
pub fn last_sent_timestamp(&self, key: &str) -> Option<Timestamp>
Get the last sent timestamp for a key
Sourcepub fn needs_send(&self, key: &str, timestamp: Timestamp) -> bool
pub fn needs_send(&self, key: &str, timestamp: Timestamp) -> bool
Check if we need to send this key (has newer timestamp)
Trait Implementations§
Source§impl Clone for PeerSyncState
impl Clone for PeerSyncState
Source§fn clone(&self) -> PeerSyncState
fn clone(&self) -> PeerSyncState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeerSyncState
impl Debug for PeerSyncState
Source§impl Default for PeerSyncState
impl Default for PeerSyncState
Source§fn default() -> PeerSyncState
fn default() -> PeerSyncState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PeerSyncState
impl RefUnwindSafe for PeerSyncState
impl Send for PeerSyncState
impl Sync for PeerSyncState
impl Unpin for PeerSyncState
impl UnwindSafe for PeerSyncState
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
Mutably borrows from an owned value. Read more