Implemented get_item_by_id for CachedCalendar
This commit is contained in:
parent
7924866e6b
commit
707d764e6b
2 changed files with 7 additions and 3 deletions
|
@ -137,6 +137,10 @@ impl DavCalendar for CachedCalendar {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>> {
|
||||||
|
Ok(self.items.get(id).cloned())
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>> {
|
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>> {
|
||||||
self.immediately_delete_item(item_id).await
|
self.immediately_delete_item(item_id).await
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,9 @@ pub trait DavCalendar : BaseCalendar {
|
||||||
/// Get the IDs and the version tags of every item in this calendar
|
/// Get the IDs and the version tags of every item in this calendar
|
||||||
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>>;
|
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>>;
|
||||||
|
|
||||||
|
/// Returns a particular item
|
||||||
|
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>>;
|
||||||
|
|
||||||
/// Delete an item
|
/// Delete an item
|
||||||
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>>;
|
async fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box<dyn Error>>;
|
||||||
|
|
||||||
|
@ -64,9 +67,6 @@ pub trait DavCalendar : BaseCalendar {
|
||||||
.map(|(id, _tag)| id.clone())
|
.map(|(id, _tag)| id.clone())
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a particular item
|
|
||||||
async fn get_item_by_id(&self, id: &ItemId) -> Result<Option<Item>, Box<dyn Error>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue