Skip to main content

cached_entry

Function cached_entry 

Source
pub fn cached_entry(
    root: &Path,
    module_id: &str,
    version: &str,
) -> Option<CachedArtifact>
Expand description

Look up a cached, verified artifact for module_id/version — keyed by VERSION ALONE (D-08): a hit never needs the feed, which is what makes SC-3 (no network on a repeat fetch) and SC-4 (offline-with-cache succeeds) possible. Accepts only filenames that strip to EXACTLY <version>- + 64 lowercase hex + .modl — no regex, just strip_prefix/strip_suffix plus a length + hex-digit check, which also disambiguates a prerelease version whose own string contains a hyphen (e.g. 2.3.4-rc1 never satisfies the fixed-length digest check when only 2.3.4 was requested).

A missing cache directory is None, never an error. Selection is DETERMINISTIC — never “whatever read_dir yielded first”: the newest entry by modified time wins, ties broken by filename order. One version can legitimately own two entries once 15-02’s accept-the-change override persists a second digest alongside the first.