pub struct FileStore { /* private fields */ }Expand description
A durable, file-backed message store with no in-memory message-body cache (bodies are read
from disk on every get()).
Implementations§
Source§impl FileStore
impl FileStore
Sourcepub fn open(dir: &Path) -> Result<Self, StoreError>
pub fn open(dir: &Path) -> Result<Self, StoreError>
Open (creating if needed) a file store in dir with default options (FileStoreSync=Y).
Sourcepub fn open_with_options(
dir: &Path,
options: FileStoreOptions,
) -> Result<Self, StoreError>
pub fn open_with_options( dir: &Path, options: FileStoreOptions, ) -> Result<Self, StoreError>
Open (creating if needed) a file store in dir with explicit options (FR-025).
Sourcepub fn was_corrupted(&self) -> bool
pub fn was_corrupted(&self) -> bool
Whether a corrupt trailing record was detected and recovered on open.
Trait Implementations§
Source§impl MessageStore for FileStore
impl MessageStore for FileStore
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 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.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.Auto Trait Implementations§
impl !Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
impl UnwindSafe for FileStore
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