pub struct SyncCursor {
pub peer_pubkey: PublicKey,
pub tree_id: ID,
pub last_synced_entry: Option<ID>,
pub last_sync_time: String,
pub last_sync_count: u64,
pub total_synced_count: u64,
}Expand description
Tracks the synchronization position for a specific peer-tree relationship.
A sync cursor represents how far synchronization has progressed between this database and a specific peer for a specific tree.
Fields§
§peer_pubkey: PublicKeyThe peer’s public key
tree_id: IDThe tree ID this cursor applies to
last_synced_entry: Option<ID>The last entry ID that was successfully synchronized
last_sync_time: StringTimestamp of the last successful sync
last_sync_count: u64Number of entries synchronized in the last session
total_synced_count: u64Total number of entries synchronized with this peer for this tree
Implementations§
Source§impl SyncCursor
impl SyncCursor
Sourcepub fn new(peer_pubkey: PublicKey, tree_id: ID, clock: &dyn Clock) -> Self
pub fn new(peer_pubkey: PublicKey, tree_id: ID, clock: &dyn Clock) -> Self
Create a new sync cursor for a peer-tree relationship.
§Arguments
peer_pubkey- The peer’s public keytree_id- The tree ID this cursor applies toclock- The time provider for timestamps
Sourcepub fn update_sync(&mut self, last_entry: ID, count: u64, clock: &dyn Clock)
pub fn update_sync(&mut self, last_entry: ID, count: u64, clock: &dyn Clock)
Update the cursor with a successful sync operation.
§Arguments
last_entry- The ID of the last synced entrycount- Number of entries synced in this operationclock- The time provider for timestamps
Sourcepub fn has_sync_history(&self) -> bool
pub fn has_sync_history(&self) -> bool
Check if this cursor has any sync history.
Trait Implementations§
Source§impl Clone for SyncCursor
impl Clone for SyncCursor
Source§fn clone(&self) -> SyncCursor
fn clone(&self) -> SyncCursor
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 SyncCursor
impl Debug for SyncCursor
Source§impl<'de> Deserialize<'de> for SyncCursor
impl<'de> Deserialize<'de> for SyncCursor
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SyncCursor
impl PartialEq for SyncCursor
Source§impl Serialize for SyncCursor
impl Serialize for SyncCursor
impl StructuralPartialEq for SyncCursor
Auto Trait Implementations§
impl Freeze for SyncCursor
impl RefUnwindSafe for SyncCursor
impl Send for SyncCursor
impl Sync for SyncCursor
impl Unpin for SyncCursor
impl UnwindSafe for SyncCursor
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
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>
Converts
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>
Converts
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