Skip to main content

Module LoadFromCache

Module LoadFromCache 

Source
Expand description

§Extension Manifest Cache Loader (B7.P08)

Loads the pre-baked extension manifest from Target/debug/extensions.manifest.json (written by Maintain/Build/Manifest/PreBake.ts as part of the debug build step).

§Why this exists

Mountain’s ScanAndPopulateExtensions currently reads 113+ package.json files sequentially from disk during boot, taking ~1200 ms on cold storage. After the build step runs PreBake.ts, the manifests are pre-merged into a single JSON blob. LoadFromCache reads that blob with a single fs::read and deserializes with serde_json::from_slice, reducing boot cost to <50 ms.

§Fallback

If the cache file is missing, stale (older than 10 min), or corrupt, the caller falls back to the normal ScanAndPopulateExtensions path.

§Cache format (written by PreBake.ts)

{
  "version": 1,
  "count": 113,
  "extensions": [
    { "id": "publisher.name", "path": "/abs/path/to/ext", "manifest": { … } }
  ]
}

Structs§

CacheBlob 🔒
Top-level cache blob.
CachedEntry 🔒
One entry in the pre-baked cache file.

Constants§

MAX_CACHE_AGE 🔒
Maximum cache age for dev/repo runs (binary sits next to the cache file).

Functions§

Fn
Try to load extension descriptors from the pre-baked manifest cache.