fix(tvix/glue/tvix_store_io): remove early return
Doing the fetch comes up with the root node, but we still need to descend from there to the desired subpath. Move things around to ensure the fetch case also only sets root_node. This logic should probably be moved into smaller, easier to consume functions. Change-Id: I6ab9317df794f53d2504029bbc77859e89fef1ed Reviewed-on: https://cl.tvl.fyi/c/depot/+/11507 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
parent
72d3f9b914
commit
e18bc33529
1 changed files with 161 additions and 152 deletions
|
@ -131,13 +131,16 @@ impl TvixStoreIO {
|
|||
.borrow()
|
||||
.get_fetch_for_output_path(store_path);
|
||||
|
||||
if let Some((name, fetch)) = maybe_fetch {
|
||||
match maybe_fetch {
|
||||
Some((name, fetch)) => {
|
||||
info!(?fetch, "triggering lazy fetch");
|
||||
let (sp, root_node) = self
|
||||
.fetcher
|
||||
.ingest_and_persist(&name, fetch)
|
||||
.await
|
||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
|
||||
.map_err(|e| {
|
||||
std::io::Error::new(std::io::ErrorKind::InvalidData, e)
|
||||
})?;
|
||||
|
||||
debug_assert_eq!(
|
||||
sp.to_string(),
|
||||
|
@ -145,9 +148,9 @@ impl TvixStoreIO {
|
|||
"store path returned from fetcher should match"
|
||||
);
|
||||
|
||||
return Ok(Some(root_node));
|
||||
root_node
|
||||
}
|
||||
|
||||
None => {
|
||||
// Look up the derivation for this output path.
|
||||
let (drv_path, drv) = {
|
||||
let known_paths = self.known_paths.borrow();
|
||||
|
@ -178,7 +181,9 @@ impl TvixStoreIO {
|
|||
let known_paths = self.known_paths.borrow();
|
||||
known_paths
|
||||
.get_drv_by_drvpath(input_drv_path)
|
||||
.unwrap_or_else(|| panic!("{} not found", input_drv_path))
|
||||
.unwrap_or_else(|| {
|
||||
panic!("{} not found", input_drv_path)
|
||||
})
|
||||
.to_owned()
|
||||
};
|
||||
|
||||
|
@ -268,7 +273,9 @@ impl TvixStoreIO {
|
|||
}),
|
||||
ca: drv.fod_digest().map(
|
||||
|fod_digest| -> tvix_store::proto::nar_info::Ca {
|
||||
(&CAHash::Nar(nix_compat::nixhash::NixHash::Sha256(fod_digest)))
|
||||
(&CAHash::Nar(nix_compat::nixhash::NixHash::Sha256(
|
||||
fod_digest,
|
||||
)))
|
||||
.into()
|
||||
},
|
||||
),
|
||||
|
@ -293,6 +300,8 @@ impl TvixStoreIO {
|
|||
.node
|
||||
.expect("invalid node")
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// now with the root_node and sub_path, descend to the node requested.
|
||||
|
|
Loading…
Reference in a new issue