ProtoStore

Struct ProtoStore 

Source
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>

Source

pub async fn mount( shared: &'static SharedFlash<M, F>, page0: u32, ) -> (Self, Option<BootPayload>)

Source

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.

Source

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.

Source

pub async fn persist(&mut self, payload: &[u8]) -> Result<(), ()>

Source

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.

Auto Trait Implementations§

§

impl<M, F> Freeze for ProtoStore<M, F>

§

impl<M, F> !RefUnwindSafe for ProtoStore<M, F>

§

impl<M, F> Send for ProtoStore<M, F>
where M: Sync, F: Send,

§

impl<M, F> Sync for ProtoStore<M, F>
where M: Sync, F: Send,

§

impl<M, F> Unpin for ProtoStore<M, F>

§

impl<M, F> !UnwindSafe for ProtoStore<M, F>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V