pub struct SyncState {
pub last_sync: Option<DateTime<Utc>>,
pub pending_items: HashMap<String, SyncItem>,
pub current_sync: Option<SyncMetadata>,
pub history: Vec<SyncMetadata>,
}Expand description
Sync state tracker
Fields§
§last_sync: Option<DateTime<Utc>>Last sync timestamp
pending_items: HashMap<String, SyncItem>Items pending sync
current_sync: Option<SyncMetadata>Current sync metadata
history: Vec<SyncMetadata>Sync history
Implementations§
Source§impl SyncState
impl SyncState
Sourcepub fn add_pending(&mut self, item: SyncItem)
pub fn add_pending(&mut self, item: SyncItem)
Add pending item
Sourcepub fn remove_pending(&mut self, item_id: &str) -> Option<SyncItem>
pub fn remove_pending(&mut self, item_id: &str) -> Option<SyncItem>
Remove pending item
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get pending items count
Sourcepub fn start_sync(&mut self, metadata: SyncMetadata)
pub fn start_sync(&mut self, metadata: SyncMetadata)
Start new sync
Sourcepub fn complete_sync(&mut self)
pub fn complete_sync(&mut self)
Complete current sync
Sourcepub fn statistics(&self) -> SyncStatistics
pub fn statistics(&self) -> SyncStatistics
Get sync statistics
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SyncState
impl<'de> Deserialize<'de> for SyncState
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
Auto Trait Implementations§
impl Freeze for SyncState
impl RefUnwindSafe for SyncState
impl Send for SyncState
impl Sync for SyncState
impl Unpin for SyncState
impl UnsafeUnpin for SyncState
impl UnwindSafe for SyncState
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