Skip to main content

Module cache

Module cache 

Source
Expand description

The pending-plan cache (#15): one full plan (PlanOptions::default) and the desired state it was planned from, reused while nothing it was planned from changed.

A plan reads the store’s working tree, state/ (ledger, trust, machine), every client file it plans and the folders detection probes, all through the Fs. While a plan is computed, a recording view of the file system notes each of these reads with what it saw (existence, content hash, folder listing). The cached plan is served only after every noted read gives the same answer again, so a store commit, a trust change, a client file edited by its client, an apply from the CLI or a new project manifest each make the next request plan again. The project repository state that git2 reads directly is noted through Fs::note_dependency.

What the file system does not show:

  • PlanCache::invalidate drops the plan (the app calls it on the drift watcher’s event);
  • a plan that read secret values (a keyring entry, an inline value) is volatile: it is shared with the requests that waited for it, never kept for later ones, because a secret store can change without any file changing.

Requests that arrive while a plan is computed wait for it instead of planning in parallel (one focus refetch asks for the plan two or three times at once).

Structs§

CachedPlan
A full plan and what it was planned from.
PlanCache
See the module documentation. One per process (the app’s Core).

Type Aliases§

OpenStore
Opens the store (None when there is none yet) over the file system it is given.