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
impl MemoryStore
Sourcepub fn new() -> MemoryStore
pub fn new() -> MemoryStore
Creates a new empty memory store.
Sourcepub fn with_initial_seqs(sender_seq: u64, target_seq: u64) -> MemoryStore
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 numbertarget_seq- Initial target sequence number
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Returns the number of stored messages.
Trait Implementations§
Source§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Source§impl MessageStore for MemoryStore
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,
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,
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
fn next_sender_seq(&self) -> u64
Returns the next sender sequence number.
Source§fn next_target_seq(&self) -> u64
fn next_target_seq(&self) -> u64
Returns the next expected target sequence number.
Source§fn set_next_sender_seq(&self, seq: u64)
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)
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,
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
fn creation_time(&self) -> SystemTime
Returns the creation time of the store/session.
Auto Trait Implementations§
impl !Freeze for MemoryStore
impl !RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnwindSafe for MemoryStore
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