From 091de12a9a735e71c119e543dab9f2999a36a5a1 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 22 Apr 2024 14:02:48 +0300 Subject: refactor(tvix/glue): move Fetch[er] into its own types, fetch lazily We actually want to delay fetching until we actually need the file. A simple evaluation asking for `.outPath` or `.drvPath` should work even in a pure offline environment. Before this CL, the fetching logic was quite distributed between tvix_store_io, and builtins/fetchers.rs. Rather than having various functions and conversions between structs, describe a Fetch as an enum type, with the fields describing the fetch. Define a store_path() function on top of `Fetch` which can be used to ask for the calculated store path (if the digest has been provided upfront). Have a `Fetcher` struct, and give it a `fetch_and_persist` function, taking a `Fetch` as well as a desired name, and have it deal with all the logic of persisting the PathInfos. It also returns a StorePathRef, similar to the `.store_path()` method on a `Fetch` struct. In a followup CL, we can extend KnownPaths to track fetches AND derivations, and then use `Fetcher` when we need to do IO into that store path. Change-Id: Ib39a96baeb661750a8706b461f8ba4abb342e777 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11500 Reviewed-by: raitobezarius Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/Cargo.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tvix/Cargo.nix') diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 9efdb7dee94e..25e5dccfd7cf 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -14101,6 +14101,10 @@ rec { name = "magic"; packageId = "magic"; } + { + name = "md-5"; + packageId = "md-5"; + } { name = "nix-compat"; packageId = "nix-compat"; @@ -14123,6 +14127,10 @@ rec { name = "serde_json"; packageId = "serde_json"; } + { + name = "sha1"; + packageId = "sha1"; + } { name = "sha2"; packageId = "sha2"; -- cgit 1.4.1