Skip to main content

ClientStore

Trait ClientStore 

Source
pub trait ClientStore:
    Debug
    + Send
    + Sync
    + 'static {
Show 56 methods // Required methods fn save_session( &self, session: StoredSession, ) -> BoxFuture<'static, StoreResult<()>>; fn load_session( &self, ) -> BoxFuture<'static, StoreResult<Option<StoredSession>>>; fn clear_session(&self) -> BoxFuture<'static, StoreResult<()>>; fn clear_account_data(&self) -> BoxFuture<'static, StoreResult<()>>; fn sync_state(&self) -> BoxFuture<'static, StoreResult<SyncState>>; fn save_sync_state( &self, state: SyncState, ) -> BoxFuture<'static, StoreResult<()>>; fn clear_sync_state(&self) -> BoxFuture<'static, StoreResult<()>>; fn sync_bucket_state( &self, key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<SyncBucketState>>; fn save_sync_bucket_state( &self, key: SyncBucketKey, state: SyncBucketState, ) -> BoxFuture<'static, StoreResult<()>>; fn save_sync_bucket_states( &self, states: Vec<(SyncBucketKey, SyncBucketState)>, ) -> BoxFuture<'static, StoreResult<()>>; fn remove_sync_bucket_state( &self, key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<()>>; fn save_pending_sync_batch( &self, batch: PendingSyncBatch, ) -> BoxFuture<'static, StoreResult<()>>; fn pending_sync_batches( &self, ) -> BoxFuture<'static, StoreResult<Vec<PendingSyncBatch>>>; fn commit_pending_sync_batch( &self, key: SyncBucketKey, state: SyncBucketState, ) -> BoxFuture<'static, StoreResult<()>>; fn dialogs( &self, request: DialogsRequest, ) -> BoxFuture<'static, StoreResult<DialogsPage>>; fn dialog( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<DialogRecord>>>; fn record_dialog( &self, dialog: DialogRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn remove_dialog( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>; fn deleted_chat_ids(&self) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>; fn record_users( &self, users: Vec<UserRecord>, ) -> BoxFuture<'static, StoreResult<()>>; fn record_space( &self, space: SpaceRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn space( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<SpaceRecord>>>; fn record_space_member( &self, member: SpaceMemberRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn record_space_members( &self, space_id: InlineId, members: Vec<SpaceMemberRecord>, ) -> BoxFuture<'static, StoreResult<()>>; fn remove_space_member( &self, space_id: InlineId, user_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>; fn space_members( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<SpaceMemberRecord>>>; fn record_user_settings( &self, settings: UserSettingsRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn user_settings( &self, ) -> BoxFuture<'static, StoreResult<Option<UserSettingsRecord>>>; fn record_chat_participants( &self, chat_id: InlineId, participants: Vec<ChatParticipantRecord>, ) -> BoxFuture<'static, StoreResult<()>>; fn record_chat_participant( &self, chat_id: InlineId, participant: ChatParticipantRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn remove_chat_participant( &self, chat_id: InlineId, user_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>; fn chat_participants( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<ChatParticipantRecord>>>; fn chat_participants_complete( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<bool>>; fn history( &self, request: HistoryRequest, ) -> BoxFuture<'static, StoreResult<HistoryPage>>; fn record_message( &self, message: MessageRecord, ) -> BoxFuture<'static, StoreResult<()>>; fn record_message_deleted( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>; fn message_deleted( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<bool>>; fn deleted_message_ids( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>; fn clear_chat_messages( &self, chat_id: InlineId, before_date: Option<i64>, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>; fn chat_ids_in_space( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>; fn record_reaction( &self, reaction: StoredReaction, ) -> BoxFuture<'static, StoreResult<()>>; fn remove_reaction( &self, reaction: StoredReaction, ) -> BoxFuture<'static, StoreResult<()>>; fn replace_message_reactions( &self, chat_id: InlineId, message_id: InlineId, reactions: Vec<StoredReaction>, ) -> BoxFuture<'static, StoreResult<()>>; fn reactions( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<StoredReaction>>>; fn reactions_for_chat( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<StoredReaction>>>; fn reaction_snapshot_message_ids( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>; fn record_read_state( &self, state: StoredReadState, ) -> BoxFuture<'static, StoreResult<()>>; fn read_state( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<StoredReadState>>>; fn record_transaction( &self, transaction: StoredTransaction, ) -> BoxFuture<'static, StoreResult<()>>; fn transaction( &self, transaction_id: TransactionId, ) -> BoxFuture<'static, StoreResult<Option<StoredTransaction>>>; // Provided methods fn discard_pending_sync_batch( &self, _key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<()>> { ... } fn commit_pending_sync_batch_with_events( &self, key: SyncBucketKey, state: SyncBucketState, events: Vec<ClientEvent>, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>> { ... } fn append_client_events( &self, events: Vec<ClientEvent>, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>> { ... } fn pending_client_events( &self, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>> { ... } fn acknowledge_client_event( &self, _delivery_id: u64, ) -> BoxFuture<'static, StoreResult<()>> { ... } fn user( &self, _user_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<UserRecord>>> { ... }
}
Expand description

Durable store boundary for client state.

Required Methods§

Source

fn save_session( &self, session: StoredSession, ) -> BoxFuture<'static, StoreResult<()>>

Saves the current session.

Source

fn load_session(&self) -> BoxFuture<'static, StoreResult<Option<StoredSession>>>

Loads the current session.

Source

fn clear_session(&self) -> BoxFuture<'static, StoreResult<()>>

Clears the current session.

Source

fn clear_account_data(&self) -> BoxFuture<'static, StoreResult<()>>

Clears all account-owned cache, sync, and transaction state while leaving the session row under separate lifecycle control.

Source

fn sync_state(&self) -> BoxFuture<'static, StoreResult<SyncState>>

Loads the global synchronization discovery cursor.

Source

fn save_sync_state( &self, state: SyncState, ) -> BoxFuture<'static, StoreResult<()>>

Saves the global synchronization discovery cursor.

Source

fn clear_sync_state(&self) -> BoxFuture<'static, StoreResult<()>>

Clears the global synchronization cursor and all bucket cursors.

Source

fn sync_bucket_state( &self, key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<SyncBucketState>>

Loads the cursor for one update bucket.

Source

fn save_sync_bucket_state( &self, key: SyncBucketKey, state: SyncBucketState, ) -> BoxFuture<'static, StoreResult<()>>

Saves the cursor for one update bucket.

Source

fn save_sync_bucket_states( &self, states: Vec<(SyncBucketKey, SyncBucketState)>, ) -> BoxFuture<'static, StoreResult<()>>

Saves multiple bucket cursors atomically when supported by the store.

Source

fn remove_sync_bucket_state( &self, key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<()>>

Removes the cursor for one update bucket.

Source

fn save_pending_sync_batch( &self, batch: PendingSyncBatch, ) -> BoxFuture<'static, StoreResult<()>>

Saves or replaces the write-ahead batch for one bucket before reducer state is changed.

Source

fn pending_sync_batches( &self, ) -> BoxFuture<'static, StoreResult<Vec<PendingSyncBatch>>>

Lists write-ahead batches that were not fully committed.

Source

fn commit_pending_sync_batch( &self, key: SyncBucketKey, state: SyncBucketState, ) -> BoxFuture<'static, StoreResult<()>>

Atomically advances a bucket cursor and removes its write-ahead batch.

Source

fn dialogs( &self, request: DialogsRequest, ) -> BoxFuture<'static, StoreResult<DialogsPage>>

Lists stored dialogs.

Source

fn dialog( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<DialogRecord>>>

Loads one stored dialog by chat ID.

Source

fn record_dialog( &self, dialog: DialogRecord, ) -> BoxFuture<'static, StoreResult<()>>

Records a dialog in local state.

Source

fn remove_dialog( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>

Removes a dialog and its client-owned per-chat state.

Source

fn deleted_chat_ids(&self) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>

Lists durable chat deletion tombstones.

Source

fn record_users( &self, users: Vec<UserRecord>, ) -> BoxFuture<'static, StoreResult<()>>

Records user summaries in local state.

Source

fn record_space( &self, space: SpaceRecord, ) -> BoxFuture<'static, StoreResult<()>>

Inserts or replaces a durable space summary.

Source

fn space( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<SpaceRecord>>>

Loads a durable space summary.

Source

fn record_space_member( &self, member: SpaceMemberRecord, ) -> BoxFuture<'static, StoreResult<()>>

Inserts or replaces one durable space member.

Source

fn record_space_members( &self, space_id: InlineId, members: Vec<SpaceMemberRecord>, ) -> BoxFuture<'static, StoreResult<()>>

Replaces the complete durable membership snapshot for one space.

Source

fn remove_space_member( &self, space_id: InlineId, user_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>

Removes one durable space member.

Source

fn space_members( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<SpaceMemberRecord>>>

Lists durable members for a space.

Source

fn record_user_settings( &self, settings: UserSettingsRecord, ) -> BoxFuture<'static, StoreResult<()>>

Replaces durable global user settings.

Source

fn user_settings( &self, ) -> BoxFuture<'static, StoreResult<Option<UserSettingsRecord>>>

Loads durable global user settings.

Source

fn record_chat_participants( &self, chat_id: InlineId, participants: Vec<ChatParticipantRecord>, ) -> BoxFuture<'static, StoreResult<()>>

Replaces the durable participant snapshot for a chat.

Source

fn record_chat_participant( &self, chat_id: InlineId, participant: ChatParticipantRecord, ) -> BoxFuture<'static, StoreResult<()>>

Inserts or replaces one durable chat participant.

Source

fn remove_chat_participant( &self, chat_id: InlineId, user_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>

Removes one durable chat participant.

Source

fn chat_participants( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<ChatParticipantRecord>>>

Loads the durable participant snapshot for a chat.

Source

fn chat_participants_complete( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<bool>>

Returns whether the participant list was observed as a complete snapshot.

Source

fn history( &self, request: HistoryRequest, ) -> BoxFuture<'static, StoreResult<HistoryPage>>

Fetches stored history.

Source

fn record_message( &self, message: MessageRecord, ) -> BoxFuture<'static, StoreResult<()>>

Records a message in stored history.

Source

fn record_message_deleted( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<()>>

Records a durable message tombstone and removes the live message row.

Source

fn message_deleted( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<bool>>

Returns whether a message has a durable deletion tombstone.

Source

fn deleted_message_ids( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>

Lists durable message deletion tombstones for one chat.

Source

fn clear_chat_messages( &self, chat_id: InlineId, before_date: Option<i64>, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>

Clears stored messages for one chat and returns the removed IDs.

Source

fn chat_ids_in_space( &self, space_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>

Lists chat IDs currently associated with a space.

Source

fn record_reaction( &self, reaction: StoredReaction, ) -> BoxFuture<'static, StoreResult<()>>

Inserts or replaces one current reaction.

Source

fn remove_reaction( &self, reaction: StoredReaction, ) -> BoxFuture<'static, StoreResult<()>>

Removes one current reaction.

Source

fn replace_message_reactions( &self, chat_id: InlineId, message_id: InlineId, reactions: Vec<StoredReaction>, ) -> BoxFuture<'static, StoreResult<()>>

Replaces the complete reaction set for one message.

Source

fn reactions( &self, chat_id: InlineId, message_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<StoredReaction>>>

Lists current reactions for a message.

Source

fn reactions_for_chat( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<StoredReaction>>>

Lists the current reaction set for all known messages in one chat.

Source

fn reaction_snapshot_message_ids( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Vec<InlineId>>>

Lists message IDs whose reaction set is known to be complete.

Source

fn record_read_state( &self, state: StoredReadState, ) -> BoxFuture<'static, StoreResult<()>>

Inserts or replaces read state for a chat.

Source

fn read_state( &self, chat_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<StoredReadState>>>

Loads read state for a chat.

Source

fn record_transaction( &self, transaction: StoredTransaction, ) -> BoxFuture<'static, StoreResult<()>>

Records a transaction state change.

Source

fn transaction( &self, transaction_id: TransactionId, ) -> BoxFuture<'static, StoreResult<Option<StoredTransaction>>>

Finds a transaction by transaction ID.

Provided Methods§

Source

fn discard_pending_sync_batch( &self, _key: SyncBucketKey, ) -> BoxFuture<'static, StoreResult<()>>

Removes an invalid write-ahead batch without advancing its bucket cursor. Stores should implement this so a journal written by an older or incompatible client cannot permanently poison startup recovery.

Source

fn commit_pending_sync_batch_with_events( &self, key: SyncBucketKey, state: SyncBucketState, events: Vec<ClientEvent>, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>>

Atomically advances a bucket cursor, records resulting lossless events, and removes its write-ahead batch. Custom stores must override this to use durable lossless delivery; the default fails before cursor commit.

Source

fn append_client_events( &self, events: Vec<ClientEvent>, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>>

Appends committed events to the durable lossless outbox while retaining best-effort events as unsequenced deliveries.

Source

fn pending_client_events( &self, ) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>>

Lists durable lossless events that have not yet been acknowledged by the host consumer.

Source

fn acknowledge_client_event( &self, _delivery_id: u64, ) -> BoxFuture<'static, StoreResult<()>>

Acknowledges one durable lossless event after the host has persisted or otherwise committed its handling.

Source

fn user( &self, _user_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<UserRecord>>>

Loads one stored user summary.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§