pub struct MemoryStore { /* private fields */ }Expand description
An in-memory store (does not survive process restart).
Implementations§
Source§impl MemoryStore
impl MemoryStore
Trait Implementations§
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 next_sender_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_sender_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The next outbound (sender) sequence number.
Source§fn next_target_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_target_seq<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The next inbound (target) sequence number expected.
Source§fn set_next_sender_seq<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_next_sender_seq<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the next outbound sequence number.
Source§fn set_next_target_seq<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_next_target_seq<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the next inbound sequence number.
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
seq: u64,
message: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
seq: u64,
message: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist an outbound message’s bytes under its sequence number.
Source§fn get<'life0, 'async_trait>(
&'life0 self,
begin: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Vec<u8>)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
begin: u64,
end: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, Vec<u8>)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve stored messages whose sequence numbers fall in
[begin, end], in order.Source§fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reset: clear stored messages and set both sequence numbers back to 1.
Source§fn contains<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contains<'life0, 'async_trait>(
&'life0 self,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Whether a message is already saved under
seq (NEW-137, audit 006): a way for callers to
observe duplicate sequence usage without changing save()’s existing overwrite-on-conflict
contract (deliberately kept separate rather than having save() itself return an
overwrote-something flag, to avoid a breaking signature change across every backend).
Default Ok(false) for any backend that doesn’t override it.Source§fn was_corrupted(&self) -> bool
fn was_corrupted(&self) -> bool
Whether this store detected and recovered from corruption when it was opened
(
ForceResendWhenCorruptedStore). Backends with no corruption-detection concept (e.g.
MemoryStore, NoopStore, SQL backends relying on the database’s own durability) default
to false.Source§fn creation_time<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<OffsetDateTime>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn creation_time<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<OffsetDateTime>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The wall-clock time this store was created (or last reset), if the backend tracks one
(GAP-38/FR-017, feature 005).
None for backends with no such concept (e.g.
MemoryStore, NoopStore) or when not yet recorded.Source§fn save_and_advance_sender<'life0, 'life1, 'async_trait>(
&'life0 self,
seq: u64,
message: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_and_advance_sender<'life0, 'life1, 'async_trait>(
&'life0 self,
seq: u64,
message: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically persist an outbound message and advance the sender sequence past it
(GAP-39/FR-018, feature 005): closes the crash window where
save() succeeds but a
subsequent set_next_sender_seq() doesn’t (or vice versa), which could otherwise
double-send or skip a sequence number on restart. The default implementation preserves
today’s behavior (two independent calls) for any backend that doesn’t override it.Auto Trait Implementations§
impl !Freeze for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin 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