From f1e6f9807252bdeee5c33dcaf288550eaec77282 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 28 Mar 2024 21:58:17 +0100 Subject: feat(tvix/glue/tvix_store_io): drop store_path_to_node_sync Let's get rid of these sync helpers, they make this less understandable. Change-Id: I3c7294647849db2747762722247c65e4e2947757 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11283 Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/glue/src/tvix_store_io.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs index 30ab97c0ca..e768e1475c 100644 --- a/tvix/glue/src/tvix_store_io.rs +++ b/tvix/glue/src/tvix_store_io.rs @@ -273,15 +273,6 @@ impl TvixStoreIO { .map_err(|e| std::io::Error::new(io::ErrorKind::Other, e)) } - fn store_path_to_node_sync( - &self, - store_path: &StorePath, - sub_path: &Path, - ) -> io::Result> { - self.tokio_handle - .block_on(async { self.store_path_to_node(store_path, sub_path).await }) - } - /// This forwards the ingestion to the [`tvix_castore::import::ingest_entries`] /// with a [`tokio::runtime::Handle::block_on`] call for synchronicity. pub(crate) fn ingest_entries_sync(&self, entries_stream: S) -> io::Result @@ -454,7 +445,8 @@ impl EvalIO for TvixStoreIO { StorePath::from_absolute_path_full(&path.to_string_lossy()) { if self - .store_path_to_node_sync(&store_path, &sub_path)? + .tokio_handle + .block_on(async { self.store_path_to_node(&store_path, &sub_path).await })? .is_some() { Ok(true) @@ -474,7 +466,10 @@ impl EvalIO for TvixStoreIO { if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(&path.to_string_lossy()) { - if let Some(node) = self.store_path_to_node_sync(&store_path, &sub_path)? { + if let Some(node) = self + .tokio_handle + .block_on(async { self.store_path_to_node(&store_path, &sub_path).await })? + { // depending on the node type, treat read_to_string differently match node { Node::Directory(_) => { @@ -542,7 +537,10 @@ impl EvalIO for TvixStoreIO { if let Ok((store_path, sub_path)) = StorePath::from_absolute_path_full(&path.to_string_lossy()) { - if let Some(node) = self.store_path_to_node_sync(&store_path, &sub_path)? { + if let Some(node) = self + .tokio_handle + .block_on(async { self.store_path_to_node(&store_path, &sub_path).await })? + { match node { Node::Directory(directory_node) => { // fetch the Directory itself. -- cgit 1.4.1