Skip to main content

InMemoryStore

Struct InMemoryStore 

Source
pub struct InMemoryStore { /* private fields */ }
Expand description

In-memory store for tests and early client development.

Implementations§

Source§

impl InMemoryStore

Source

pub fn new() -> Self

Creates an empty in-memory store.

Source

pub fn upsert_dialog(&self, dialog: DialogRecord)

Inserts or replaces a dialog.

Source

pub fn upsert_user(&self, user: UserRecord)

Inserts or replaces a user summary.

Source

pub fn insert_message(&self, message: MessageRecord)

Inserts a message into history.

Trait Implementations§

Source§

impl ClientStore for InMemoryStore

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.
Source§

impl Clone for InMemoryStore

Source§

fn clone(&self) -> InMemoryStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InMemoryStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InMemoryStore

Source§

fn default() -> InMemoryStore

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more