Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
Show 13 methods // Required methods fn create_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, event: &'life2 VEvent<String>, ) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_event<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<VEvent<String>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, patch: &'life2 EventPatch, ) -> Pin<Box<dyn Future<Output = Result<VEvent<String>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn delete_event<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn create_todo<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, todo: &'life2 VTodo<String>, ) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_todo<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<VTodo<String>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_todo<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, patch: &'life2 TodoPatch, ) -> Pin<Box<dyn Future<Output = Result<VTodo<String>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn delete_todo<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, VEvent<String>)>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_todos<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, VTodo<String>)>, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn uid_exists<'life0, 'life1, 'async_trait>( &'life0 self, 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 calendar_id(&self) -> &str; fn sync_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncResult, StoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Store trait for storing and synchronizing events and todos.

This trait abstracts different storage backends (local ICS files, CalDAV servers, etc.) providing a unified interface for CRUD operations on calendar items.

Required Methods§

Source

fn create_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, event: &'life2 VEvent<String>, ) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a new event in the store.

§Arguments
  • uid - The unique identifier for the event
  • event - The event to create
§Errors

Returns an error if the event cannot be created in the store.

Source

fn get_event<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<VEvent<String>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves an event from the store by UID.

§Arguments
  • uid - The unique identifier of the event to retrieve
§Errors

Returns an error if the event is not found or cannot be retrieved.

Source

fn update_event<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, patch: &'life2 EventPatch, ) -> Pin<Box<dyn Future<Output = Result<VEvent<String>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates an existing event in the store.

§Arguments
  • uid - The unique identifier of the event to update
  • patch - The patch to apply to the event
§Errors

Returns an error if the event is not found or cannot be updated.

Source

fn delete_event<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes an event from the store.

§Arguments
  • uid - The unique identifier of the event to delete
§Errors

Returns an error if the event is not found or cannot be deleted.

Source

fn create_todo<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, todo: &'life2 VTodo<String>, ) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a new todo in the store.

§Arguments
  • uid - The unique identifier for the todo
  • todo - The todo to create
§Errors

Returns an error if the todo cannot be created in the store.

Source

fn get_todo<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<VTodo<String>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves a todo from the store by UID.

§Arguments
  • uid - The unique identifier of the todo to retrieve
§Errors

Returns an error if the todo is not found or cannot be retrieved.

Source

fn update_todo<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, uid: &'life1 str, patch: &'life2 TodoPatch, ) -> Pin<Box<dyn Future<Output = Result<VTodo<String>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates an existing todo in the store.

§Arguments
  • uid - The unique identifier of the todo to update
  • patch - The patch to apply to the todo
§Errors

Returns an error if the todo is not found or cannot be updated.

Source

fn delete_todo<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a todo from the store.

§Arguments
  • uid - The unique identifier of the todo to delete
§Errors

Returns an error if the todo is not found or cannot be deleted.

Source

fn list_events<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, VEvent<String>)>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all events in the store.

§Errors

Returns an error if the events cannot be listed.

Source

fn list_todos<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, VTodo<String>)>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all todos in the store.

§Errors

Returns an error if the todos cannot be listed.

Source

fn uid_exists<'life0, 'life1, 'async_trait>( &'life0 self, uid: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if a UID exists in the store.

§Arguments
  • uid - The unique identifier to check
§Returns

true if the UID exists, false otherwise.

§Errors

Returns an error if the check cannot be performed.

Source

fn calendar_id(&self) -> &str

Returns the calendar identifier for this store.

This identifies which calendar in the database items from this store belong to.

Source

fn sync_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncResult, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Synchronizes the store with the local cache (database).

This operation scans the store for changes and updates the local database accordingly.

§Returns

A SyncResult containing counts of created, updated, and deleted items.

§Errors

Returns an error if synchronization fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§