pub trait MessageStore {
// Required methods
fn write(
&mut self,
target: Address,
data: &[u8],
ttl_secs: u16,
created_at_secs: u32,
) -> StoreResult;
fn read(&mut self, target: Address, buf: &mut [u8]) -> Option<usize>;
fn peek_size(&self, target: Address) -> Option<usize>;
fn pending_targets(&self) -> u16;
fn expire(&mut self, now_secs: u32);
}Expand description
Persistent message store for delay-tolerant delivery.
Stores whole application messages (pre-segmentation) on
behalf of the SRSPP sender. Messages are keyed by
destination Address and drained in FIFO order per
target.
Implementations typically use OSAL file I/O
(leodos_libcfs::os::fs) for persistence. A RAM-backed
implementation can be used for testing.
Required Methods§
Sourcefn write(
&mut self,
target: Address,
data: &[u8],
ttl_secs: u16,
created_at_secs: u32,
) -> StoreResult
fn write( &mut self, target: Address, data: &[u8], ttl_secs: u16, created_at_secs: u32, ) -> StoreResult
Persist a message for later delivery.
target— destination address (e.g., a ground station).data— raw message bytes (pre-segmentation).ttl_secs— time-to-live in seconds; 0 = no expiry.created_at_secs— creation timestamp in seconds (wrapping).
Sourcefn read(&mut self, target: Address, buf: &mut [u8]) -> Option<usize>
fn read(&mut self, target: Address, buf: &mut [u8]) -> Option<usize>
Read and remove the oldest stored message for
target. Copies the message into buf and returns
its length. Returns None if nothing is stored for
that target.
Sourcefn peek_size(&self, target: Address) -> Option<usize>
fn peek_size(&self, target: Address) -> Option<usize>
Returns the byte length of the next message for
target without removing it. Used by the driver to
check if the message fits in the SRSPP buffer before
reading.
Sourcefn pending_targets(&self) -> u16
fn pending_targets(&self) -> u16
Bitmap of targets that have pending messages. Bit N set = ground station N has at least one stored message.