Skip to main content

Mountain/ApplicationState/Internal/Persistence/
MementoLoader.rs

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