pub struct SqliteStore { /* private fields */ }Expand description
SQLite-backed durable store.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open(path: impl AsRef<Path>) -> StoreResult<Self>
pub fn open(path: impl AsRef<Path>) -> StoreResult<Self>
Opens a SQLite store at path, creating parent directories and schema.
Sourcepub fn open_in_memory() -> StoreResult<Self>
pub fn open_in_memory() -> StoreResult<Self>
Opens an in-memory SQLite store.
Sourcepub fn upsert_dialog(&self, dialog: DialogRecord) -> StoreResult<()>
pub fn upsert_dialog(&self, dialog: DialogRecord) -> StoreResult<()>
Inserts or replaces a dialog.
Sourcepub fn upsert_user(&self, user: UserRecord) -> StoreResult<()>
pub fn upsert_user(&self, user: UserRecord) -> StoreResult<()>
Inserts or replaces a user summary.
Sourcepub fn insert_message(&self, message: MessageRecord) -> StoreResult<()>
pub fn insert_message(&self, message: MessageRecord) -> StoreResult<()>
Inserts a message into history.
Trait Implementations§
Source§impl ClientStore for SqliteStore
impl ClientStore for SqliteStore
Source§fn save_session(
&self,
session: StoredSession,
) -> BoxFuture<'static, StoreResult<()>>
fn save_session( &self, session: StoredSession, ) -> BoxFuture<'static, StoreResult<()>>
Saves the current session.
Source§fn load_session(&self) -> BoxFuture<'static, StoreResult<Option<StoredSession>>>
fn load_session(&self) -> BoxFuture<'static, StoreResult<Option<StoredSession>>>
Loads the current session.
Source§fn clear_session(&self) -> BoxFuture<'static, StoreResult<()>>
fn clear_session(&self) -> BoxFuture<'static, StoreResult<()>>
Clears the current session.
Source§fn clear_account_data(&self) -> BoxFuture<'static, StoreResult<()>>
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>>
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<()>>
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<()>>
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>>
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<()>>
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<()>>
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<()>>
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<()>>
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>>>
fn pending_sync_batches( &self, ) -> BoxFuture<'static, StoreResult<Vec<PendingSyncBatch>>>
Lists write-ahead batches that were not fully committed.
Source§fn discard_pending_sync_batch(
&self,
key: SyncBucketKey,
) -> BoxFuture<'static, StoreResult<()>>
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(
&self,
key: SyncBucketKey,
state: SyncBucketState,
) -> BoxFuture<'static, StoreResult<()>>
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 commit_pending_sync_batch_with_events(
&self,
key: SyncBucketKey,
state: SyncBucketState,
events: Vec<ClientEvent>,
) -> BoxFuture<'static, StoreResult<Vec<ClientEventDelivery>>>
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>>>
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>>>
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<()>>
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 dialogs(
&self,
request: DialogsRequest,
) -> BoxFuture<'static, StoreResult<DialogsPage>>
fn dialogs( &self, request: DialogsRequest, ) -> BoxFuture<'static, StoreResult<DialogsPage>>
Lists stored dialogs.
Source§fn dialog(
&self,
chat_id: InlineId,
) -> BoxFuture<'static, StoreResult<Option<DialogRecord>>>
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<()>>
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<()>>
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>>>
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<()>>
fn record_users( &self, users: Vec<UserRecord>, ) -> BoxFuture<'static, StoreResult<()>>
Records user summaries in local state.
Source§fn user(
&self,
user_id: InlineId,
) -> BoxFuture<'static, StoreResult<Option<UserRecord>>>
fn user( &self, user_id: InlineId, ) -> BoxFuture<'static, StoreResult<Option<UserRecord>>>
Loads one stored user summary.
Source§fn record_space(
&self,
space: SpaceRecord,
) -> BoxFuture<'static, StoreResult<()>>
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>>>
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<()>>
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<()>>
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<()>>
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>>>
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<()>>
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>>>
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<()>>
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<()>>
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<()>>
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>>>
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>>
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>>
fn history( &self, request: HistoryRequest, ) -> BoxFuture<'static, StoreResult<HistoryPage>>
Fetches stored history.
Source§fn record_message(
&self,
message: MessageRecord,
) -> BoxFuture<'static, StoreResult<()>>
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<()>>
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>>
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>>>
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>>>
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>>>
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<()>>
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<()>>
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<()>>
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>>>
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>>>
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>>>
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<()>>
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>>>
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<()>>
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>>>
fn transaction( &self, transaction_id: TransactionId, ) -> BoxFuture<'static, StoreResult<Option<StoredTransaction>>>
Finds a transaction by transaction ID.
Source§impl Clone for SqliteStore
impl Clone for SqliteStore
Source§fn clone(&self) -> SqliteStore
fn clone(&self) -> SqliteStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SqliteStore
impl RefUnwindSafe for SqliteStore
impl Send for SqliteStore
impl Sync for SqliteStore
impl Unpin for SqliteStore
impl UnsafeUnpin for SqliteStore
impl UnwindSafe for SqliteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more