Skip to main content

commit_download

Function commit_download 

Source
pub fn commit_download(
    store_root: &Path,
    download: &PinnedDownload,
    program: &str,
    partial: PartialDownload,
) -> Result<CommittedEntry, PinnedStoreError>
Expand description

Unpacks a download whose bytes already hash to download.sha256 and moves it into <store_root>/<sha256>/ with its record and bin/<program> link.

partial holds the downloaded bytes at PartialDownload::download_path. With run, they are a zip: every entry is unpacked under files/ with group and other bits stripped; a symlink entry, an absolute or .. entry name, a tree over MAX_PINNED_DOWNLOAD_BYTES or a run naming no regular file refuses (PinnedStoreError::Unpack). Without run, the bytes are the program, stored executable under the URL’s last path segment. The record is written last and the folder renamed into place; when a concurrent install got there first, ours is discarded and theirs verified. Nothing is left behind on any failure.