Skip to main content

ensure_cached_hub

Function ensure_cached_hub 

Source
pub fn ensure_cached_hub(version: &str) -> Result<PathBuf, String>
Expand description

Ensures the Hub for version is present, verified, and extracted under the per-user cache, fetching it over the network if needed. Returns the path to the extracted component directory (containing <id>/component.yml entries at its top level, ready to hand to crate::ComponentSource::hub).

Cache layout per version: <cache_root>/warble/hub/<version>/{hub-<version>.tar.gz, hub-<version>.tar.gz.sha256, extracted/}. A hit is decided by recomputing the archive’s SHA-256 against the sidecar every call — see the module-level cache-trust discussion for why. extracted/ is always rebuilt fresh from the verified archive, regardless of hit or miss.