Skip to main content

Module PathCanon

Module PathCanon 

Source
Expand description

Process-wide canonical-path cache.

Keyed by lexical input path; value is the result of dunce::canonicalize. Hits skip the syscall; misses run it and cache the result.

The fs-scope security gates that Mountain layers around every incoming path canonicalise repeatedly during boot: 113 extension manifest paths, ~80 chunked workbench JS imports, ~60 git-extension scope checks, every vscode-file:// request. Collapsing repeats to a hash lookup saves ~150 ms cumulative on the boot path.

time_to_idle = 60s: resets on each access, so hot paths stay cached indefinitely while one-shot paths evict naturally. Bounds staleness against external mv / rename.

Modules§

Cache ðŸ”’
Process-global canonical-path cache backing store.
CacheStats
Diagnostic snapshot of the canonical-path cache.
Canonicalize
Canonicalise via the cache. Returns the cached entry on hit; runs dunce::canonicalize on miss and caches the result.
CanonicalizeUncached
Canonicalise without caching. For one-shot calls where the result is immediately discarded; avoids polluting the cache with paths that will not repeat.
Clear
Clear the entire path-canon cache. Diagnostic / shutdown use.
Invalidate
Force-evict an entry. Called from notify watchers when a path rename is observed inside the workspace, or by the dev-mode hot-reload signal.
SpawnDiagnosticLogger
Spawn a tokio task that logs cache stats every 30s under the path-canon target. Optional - call from the embedder’s runtime setup when the user has the path-canon tag enabled.
Stats
Capture a diagnostic snapshot of the cache.