SyncBookkeeping

Trait SyncBookkeeping 

Source
pub trait SyncBookkeeping: Send + Sync {
    // Required methods
    fn get_sync_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_sync_state<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_all_sync_cursors<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u64>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_sync_cursor<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device_id: &'life1 str,
        seq: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_pending_cloud_uploads<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxEntry>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_pending_cloud_deletes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxEntry>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn has_pending_cloud_uploads<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_cloud_outbox_entry<'life0, 'async_trait>(
        &'life0 self,
        id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Bookkeeping the host’s database performs against coven’s tables. coven calls these during a sync cycle; the host’s implementation runs the SQL.

Required Methods§

Source

fn get_sync_state<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a value from sync_state by key.

Source

fn set_sync_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a value to sync_state.

Source

fn get_all_sync_cursors<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u64>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

All per-device cursors from sync_cursors as device_id -> last_seq.

Source

fn set_sync_cursor<'life0, 'life1, 'async_trait>( &'life0 self, device_id: &'life1 str, seq: u64, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upsert a single device cursor.

Source

fn get_pending_cloud_uploads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxEntry>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Pending upload entries from cloud_outbox, oldest first.

Source

fn get_pending_cloud_deletes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxEntry>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Pending delete entries from cloud_outbox.

Source

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

Whether any upload entries remain (gates changeset push).

Source

fn remove_cloud_outbox_entry<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a cloud_outbox entry by id.

Implementors§