Skip to main content

pacenotes_installer/
restore.rs

1//! Taking a game folder back to a restore point, for a user handed a bad
2//! package who wants yesterday back: whatever they had configured then, and
3//! none of the files the bad package added. See `DESIGN.md` "Restore scene".
4//!
5//! Every run writes a point holding the ledger as it was before it, plus the
6//! files it replaced; this module reads them back, plans the way to one and
7//! carries that plan out through the engine's own steps. Three rules:
8//!
9//! 1. **The plan is a value, computed before anything moves**, so the preview
10//!    the user approves and the work done cannot disagree.
11//! 2. **Never make it worse.** A package that cannot be put back is left as it
12//!    is, and nothing is removed unless what replaces it is ready.
13//! 3. **Restore the provenance, not just the bytes.** The snapshot's per-file
14//!    `prior` is what stops a later uninstall deleting a file the user always had.
15
16mod changes;
17mod execute;
18mod plan;
19mod point;
20
21pub use changes::{changes, Changes};
22pub use execute::{execute, prepare, Prepared};
23pub use plan::{ledger_after, picks, plan, Plan, PutBack};
24pub use point::{human_time, payloads_in_use, points, read, Point, Snapshot};
25
26#[cfg(test)]
27mod tests;