Skip to main content

push_path

Function push_path 

Source
pub async fn push_path(
    storage: &dyn StorageBackend,
    signer: &CacheSigner,
    store_path: &str,
    hash: &str,
    references: &[String],
    deriver: Option<&str>,
    codec: NarCodec,
) -> Result<PushResult, CacheError>
Expand description

Push a store path to the binary cache.

  1. Dump the path as NAR
  2. Hash the uncompressed NAR (sha256)
  3. Compress under codec
  4. Hash the compressed NAR (sha256)
  5. Build narinfo metadata
  6. Sign the narinfo
  7. Upload NAR blob and narinfo

The store_path should be an absolute path like /nix/store/abc-hello-1.0. The hash is the 32-character store path hash (the abc part).

references are the runtime dependency store path basenames.

codec is the packing posture — resolved from CacheConfig::nar_codec, never chosen here. It is one value and it is threaded, not re-stated: the bytes, the URL suffix and the Compression: field below all read the same parameter, so a caller has no way to pick zstd bytes and an xz narinfo. See NarCodec.

§Errors

CacheError::PathNotFound if store_path does not exist, CacheError::Io if the NAR dump or compression fails, or whatever the backend returns from the two uploads.