Skip to main content

Module restore

Module restore 

Source
Expand description

Taking a game folder back to a restore point, for a user handed a bad package who wants yesterday back: whatever they had configured then, and none of the files the bad package added. See DESIGN.md “Restore scene”.

Every run writes a point holding the ledger as it was before it, plus the files it replaced; this module reads them back, plans the way to one and carries that plan out through the engine’s own steps. Three rules:

  1. The plan is a value, computed before anything moves, so the preview the user approves and the work done cannot disagree.
  2. Never make it worse. A package that cannot be put back is left as it is, and nothing is removed unless what replaces it is ready.
  3. Restore the provenance, not just the bytes. The snapshot’s per-file prior is what stops a later uninstall deleting a file the user always had.

Modules§

changes 🔒
execute 🔒
plan 🔒
point 🔒

Structs§

Changes
What the run that followed a point did, counted for the list of points.
Plan
What restoring to a point would do, shown as the preview and then carried out unchanged.
Point
One restore point, named by the UTC stamp of the run that followed it.
Prepared
Everything read and checked before the first file moves, as engine::preflight does for an install.
PutBack
One package the restore has to put back.

Functions§

changes
after is the next point’s snapshot, or the live ledger for the newest point.
execute
Carries out a restore, opening a restore point of its own first, so a restore to the wrong point can be undone like any other run.
human_time
A point’s name as a person reads a date, 2026-10-27 12:11.
ledger_after
The ledger once plan has been carried out, failed naming what could not be put back after all.
payloads_in_use
The payload digests this folder’s ledger and every restore point name: what a sweep of the cache must keep beyond what its index names, since a restore rolls back to an older payload the index has moved past.
picks
Per single-pick category, the package the restored state holds in it, which is what the game’s configuration step needs to make it the user’s pick again.
plan
What it takes to make live look like target.
points
Every readable restore point in a game folder, newest first.
prepare
Finds a missing or damaged payload, an unwritable folder, too little room or a running game while the folder is still untouched.
read
The point called name, or None when it has no readable snapshot.

Type Aliases§

Snapshot
The packages a ledger held at one moment, keyed as the ledger keys them.