pub struct InMemoryCalendarStore { /* private fields */ }Expand description
In-memory CalendarStore backed by Vecs under an RwLock. Build
via Self::new + chainable with_* setters.
Implementations§
Source§impl InMemoryCalendarStore
impl InMemoryCalendarStore
Sourcepub fn with_calendar(self, owner: &str, cal: Calendar) -> Self
pub fn with_calendar(self, owner: &str, cal: Calendar) -> Self
Append a calendar owned by owner. Use make_calendar for a sane default shape.
Sourcepub fn with_event(self, calendar_id: i64, event: Event) -> Self
pub fn with_event(self, calendar_id: i64, event: Event) -> Self
Append an event to the given calendar id.
Sourcepub fn list_calendars_fails(self, msg: &str) -> Self
pub fn list_calendars_fails(self, msg: &str) -> Self
Make CalendarStore::list_calendars return an error carrying msg.
Sourcepub fn get_calendar_fails(self, msg: &str) -> Self
pub fn get_calendar_fails(self, msg: &str) -> Self
Make CalendarStore::get_calendar return an error carrying msg.
Sourcepub fn list_events_fails(self, msg: &str) -> Self
pub fn list_events_fails(self, msg: &str) -> Self
Make CalendarStore::list_events return an error carrying msg.
Sourcepub fn get_event_fails(self, msg: &str) -> Self
pub fn get_event_fails(self, msg: &str) -> Self
Make CalendarStore::get_event return an error carrying msg.
Sourcepub fn event_etag_fails(self, msg: &str) -> Self
pub fn event_etag_fails(self, msg: &str) -> Self
Make CalendarStore::event_etag return an error carrying msg.
Sourcepub fn put_event_fails(self, msg: &str) -> Self
pub fn put_event_fails(self, msg: &str) -> Self
Make CalendarStore::put_event return an error carrying msg.
Sourcepub fn delete_event_fails(self, msg: &str) -> Self
pub fn delete_event_fails(self, msg: &str) -> Self
Make CalendarStore::delete_event return an error carrying msg.
Sourcepub fn ensure_default_fails(self, msg: &str) -> Self
pub fn ensure_default_fails(self, msg: &str) -> Self
Make the ensure_default_* trait method return an error carrying msg.
Sourcepub fn events_in(&self, calendar_id: i64) -> Vec<Event>
pub fn events_in(&self, calendar_id: i64) -> Vec<Event>
Read back every event currently stored for calendar_id. Tests use this to assert handler-driven mutations.
Sourcepub fn default_calendar_was_created_for(&self, user: &str) -> bool
pub fn default_calendar_was_created_for(&self, user: &str) -> bool
true when CalendarStore::ensure_default_calendar fired for user.
Trait Implementations§
Source§impl CalendarStore for InMemoryCalendarStore
impl CalendarStore for InMemoryCalendarStore
Source§fn list_calendars<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Calendar>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_calendars<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Calendar>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
user.Source§fn get_calendar<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
calendar_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Calendar>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_calendar<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
calendar_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Calendar>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
user + URL-decoded calendar_name. Returns
Ok(None) when the calendar exists but doesn’t belong to user, or
when no such calendar exists.Source§fn list_events<'life0, 'async_trait>(
&'life0 self,
calendar_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_events<'life0, 'async_trait>(
&'life0 self,
calendar_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
calendar_id. Order is store-defined; handlers do
not rely on ordering.Source§fn get_event<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_event<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Event>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(calendar_id, uid).Source§fn event_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn event_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(calendar_id, uid). Used by handlers to
perform If-Match / If-None-Match: * precondition checks without
pulling the full icalendar body.Source§fn put_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
icalendar: &'life2 str,
etag: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<PutResult, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put_event<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
icalendar: &'life2 str,
etag: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<PutResult, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
icalendar is the raw RFC 5545 text; etag
is a freshly-computed digest the handler wants the store to record. Read moreSource§fn delete_event<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_event<'life0, 'life1, 'async_trait>(
&'life0 self,
calendar_id: i64,
uid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
true when a row was actually removed,
false for not-found (handler maps that to 404).Source§fn ensure_default_calendar<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_default_calendar<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
user if they have none.
Called from PROPFIND on the principal / calendar home so first-login
clients see something to subscribe to.