pub struct SyncState {
pub last_sync_at: Option<DateTime<Utc>>,
pub next_sync_at: Option<DateTime<Utc>>,
pub last_sync_count: Option<u64>,
pub last_sync_success: Option<bool>,
}Expand description
Persistent state for daemon sync scheduling.
Fields§
§last_sync_at: Option<DateTime<Utc>>When the last sync was performed (successfully or not).
next_sync_at: Option<DateTime<Utc>>When the next sync is scheduled.
last_sync_count: Option<u64>Number of sessions synced in the last sync.
last_sync_success: Option<bool>Whether the last sync was successful.
Implementations§
Source§impl SyncState
impl SyncState
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Loads the sync state from a specific path.
Returns the default state if the file does not exist.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Loads the sync state from disk.
Returns the default state if the file does not exist.
Sourcepub fn save_to_path(&self, path: &Path) -> Result<()>
pub fn save_to_path(&self, path: &Path) -> Result<()>
Saves the sync state to a specific path atomically.
Creates parent directories if they do not exist.
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 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