Better API for last sync timestamp
This commit is contained in:
parent
6c4ffa020c
commit
df9d5a2d07
4 changed files with 44 additions and 13 deletions
|
@ -2,6 +2,7 @@ use std::error::Error;
|
|||
|
||||
use async_trait::async_trait;
|
||||
use url::Url;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
use crate::Calendar;
|
||||
|
||||
|
@ -25,3 +26,11 @@ pub trait CalDavSource {
|
|||
async fn get_calendar_mut(&mut self, url: Url) -> Option<&mut Calendar>;
|
||||
|
||||
}
|
||||
|
||||
pub trait SyncSlave {
|
||||
/// Returns the last time this source successfully synced from a master source (e.g. from a server)
|
||||
/// (or None in case it has never been synchronized)
|
||||
fn get_last_sync(&self) -> Option<DateTime<Utc>>;
|
||||
/// Update the last sync timestamp to now, or to a custom time in case `timepoint` is `Some`
|
||||
fn update_last_sync(&mut self, timepoint: Option<DateTime<Utc>>);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue