populate_cache

Function populate_cache 

Source
pub fn populate_cache(
    source: &Utf8Path,
    cache_dir: &Utf8Path,
    version: &str,
) -> BootstrapResult<()>
Expand description

Populates the cache with binaries from the given source directory.

After a successful download, call this function to copy binaries to the cache and write the completion marker.

§Arguments

  • source - Directory containing freshly downloaded/extracted binaries
  • cache_dir - Root directory of the binary cache
  • version - Version string for the cache entry

§Errors

Returns an error if:

  • The cache directory cannot be created
  • Copying binaries fails
  • Writing the completion marker fails

§Examples

use camino::Utf8Path;
use pg_embedded_setup_unpriv::cache::populate_cache;

let source = Utf8Path::new("/tmp/sandbox/install/17.4.0");
let cache_dir = Utf8Path::new("/home/user/.cache/pg-embedded/binaries");
populate_cache(source, cache_dir, "17.4.0")?;