Skip to main content

Mountain/ApplicationState/Internal/Persistence/
MementoLoader.rs

1#![allow(non_snake_case)]
2
3//! # MementoLoader - Persistence layer
4//!
5//! Loads `ApplicationState` memento JSON from disk during boot.
6//! Two flavours: best-effort (returns empty on failure) and
7//! result-typed (surfaces failures explicitly during recovery).
8//!
9//! Layout (one export per file, file name = identity):
10//! - `LoadInitialMementoFromDisk::Fn` - best-effort loader for
11//!   `ApplicationState::default()`. Backs up corrupted files, creates the
12//!   parent directory on read errors.
13//! - `LoadMementoWithRecovery::Fn` - result-typed loader used during recovery
14//!   flows; surfaces FS / parse failures.
15//! - `AttemptMementoRecovery::Fn` (internal) - write a `.backup` sibling for
16//!   the corrupted content.
17//! - `CreateCorruptedBackup::Fn` (internal) - write a timestamped
18//!   `.json.corrupted.<ts>` sibling.
19//!
20//! ## Status
21//!
22//! Zero callers as of 2026-05-02 - pending wire-up from
23//! `Environment::StorageProvider` boot path.
24
25pub mod AttemptMementoRecovery;
26
27pub mod CreateCorruptedBackup;
28
29pub mod LoadInitialMementoFromDisk;
30
31pub mod LoadMementoWithRecovery;