tvl-depot/tvix/nar-bridge
Florian Klink 85de9b8dab feat(tvix/nar-bridge): avoid unnecessary NAR uploads
When uploading a Store Path to a Nix HTTP Binary Cache, Nix first does a
HEAD request for $outhash.narinfo, and if that's not found, for
`{narhash}.nar[.compression_suffix]`.

If the NAR is already present, only the NARInfo is uploaded.

Even though we don't have a service allowing to globally look up from
NARHash to root node, `root_nodes` in `AppState` at least contains
recently uploaded NARHashes.

If we find it in there, we can prevent Nix unnecessarily uploading NARs
if the same contents have already been recently uploaded.
We also promote this key, chances are high Nix will subsequently upload
a NARInfo referring to this NARHash.

Change-Id: I34e3fd9b334b695abe945e64cd291e30f303c2a2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12752
Tested-by: BuildkiteCI
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Autosubmit: flokli <flokli@flokli.de>
2024-11-12 00:26:30 +00:00
..
src feat(tvix/nar-bridge): avoid unnecessary NAR uploads 2024-11-12 00:26:30 +00:00
Cargo.toml feat(tvix/nar-bridge): implement range request for NARs 2024-09-30 10:04:29 +00:00
default.nix chore(tvix): Retain original passthru in Rust builds 2024-08-15 23:37:00 +00:00