pub struct ProtoStore<M: RawMutex + 'static, F: JournalFlash + 'static> { /* private fields */ }Expand description
Runtime handle for one full-protocol record journal: the snapshot journal, the device-identity journal, the device-node counter journal, or a board’s own preferences journal — selected by its first page. Executes durable effects; a caller’s RAM mirror is only updated after these return.
Implementations§
Source§impl<M: RawMutex + 'static, F: JournalFlash + 'static> ProtoStore<M, F>
impl<M: RawMutex + 'static, F: JournalFlash + 'static> ProtoStore<M, F>
pub async fn mount( shared: &'static SharedFlash<M, F>, page0: u32, ) -> (Self, Option<BootPayload>)
Sourcepub fn flash(&self) -> &'static SharedFlash<M, F>
pub fn flash(&self) -> &'static SharedFlash<M, F>
The shared flash this journal writes through.
Exposed for whole-region operations that are not journal writes at all — a factory reset erases every page in the NV region, including journals no handle is currently mounted on.
Sourcepub async fn older_snapshot(&mut self, out: &mut [u8]) -> Option<usize>
pub async fn older_snapshot(&mut self, out: &mut [u8]) -> Option<usize>
Copy the newest committed snapshot record strictly older than the
last one handed out into out, for the boot path’s walk-back past
a payload the session rejected.
Re-scans rather than retaining a runner-up at mount, so the mount path never buffers a second copy; the scan is only ever paid on a boot that already failed to restore. A tombstone ends the walk: it asserts “nothing saved”, and older records physically behind it are void.
pub async fn persist(&mut self, payload: &[u8]) -> Result<(), ()>
Sourcepub async fn clear(&mut self) -> Result<(), ()>
pub async fn clear(&mut self) -> Result<(), ()>
The clear transaction is one committed tombstone record: if its write fails or is interrupted, the previous snapshot remains authoritative and the caller reports failure. Pages are never erased as part of a clear — stale records are reclaimed by the ordinary rotation.