Skip to main content

MemoryStore

Struct MemoryStore 

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

In-memory message store.

Stores messages in a BTreeMap for efficient range queries. Not persistent - all data is lost when the process exits.

Implementations§

Source§

impl MemoryStore

Source

pub fn new() -> MemoryStore

Creates a new empty memory store.

Source

pub fn with_initial_seqs(sender_seq: u64, target_seq: u64) -> MemoryStore

Creates a new memory store with initial sequence numbers.

§Arguments
  • sender_seq - Initial sender sequence number
  • target_seq - Initial target sequence number
Source

pub fn message_count(&self) -> usize

Returns the number of stored messages.

Source

pub fn contains(&self, seq_num: u64) -> bool

Checks if a message with the given sequence number exists.

Trait Implementations§

Source§

impl Debug for MemoryStore

Source§

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

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

impl Default for MemoryStore

Source§

fn default() -> MemoryStore

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

impl MessageStore for MemoryStore

Source§

fn store<'life0, 'life1, 'async_trait>( &'life0 self, seq_num: u64, message: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MemoryStore: 'async_trait,

Stores an outgoing message for potential resend. Read more
Source§

fn get_range<'life0, 'async_trait>( &'life0 self, begin: u64, end: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<OwnedMessage>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, MemoryStore: 'async_trait,

Retrieves messages for a resend request. Read more
Source§

fn next_sender_seq(&self) -> u64

Returns the next sender sequence number.
Source§

fn next_target_seq(&self) -> u64

Returns the next expected target sequence number.
Source§

fn set_next_sender_seq(&self, seq: u64)

Sets the next sender sequence number. Read more
Source§

fn set_next_target_seq(&self, seq: u64)

Sets the next expected target sequence number. Read more
Source§

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

Resets the store, clearing all messages and resetting sequence numbers. Read more
Source§

fn creation_time(&self) -> SystemTime

Returns the creation time of the store/session.
Source§

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

Refreshes the store from persistent storage. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.