download_catalog_release

Function download_catalog_release 

Source
pub(super) fn download_catalog_release<FStart, FProgress>(
    client: &Client,
    plan: &CatalogDownloadPlan,
    catalog_temp_path: &Path,
    metadata_temp_path: &Path,
    on_start: FStart,
    on_progress: FProgress,
) -> Result<()>
where FStart: FnOnce(Option<u64>), FProgress: FnMut(u64),
Expand description

Downloads a full catalog snapshot through the two-stage update flow.

The function keeps the refresh sequence strict and explicit:

  1. download the metadata JSON into metadata_temp_path
  2. parse the metadata and confirm its current_hash when the plan carries an expected hash
  3. download the compressed catalog snapshot into a sibling .zst temp file
  4. decompress the snapshot into catalog_temp_path
  5. verify the final database hash against the metadata hash

The caller owns the final metadata and catalog temp files. This function only removes the internal compressed snapshot temp file it creates while processing the release.

ยงErrors

Returns an error when the plan is not Full, when either download fails, when the metadata hash does not match the expected hash, when decompression fails, or when the final catalog hash check fails.