diff options
author | Florian Klink <flokli@flokli.de> | 2024-03-28T20·58+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-03-28T21·17+0000 |
commit | f1e6f9807252bdeee5c33dcaf288550eaec77282 (patch) | |
tree | 80dd4ef80ef4d476c9ad222d1ad8a9e1e12f50f2 /tvix/glue/src | |
parent | 6e8046bec7013abfdbf179ce46beaa0741ed94be (diff) |
feat(tvix/glue/tvix_store_io): drop store_path_to_node_sync r/7798
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 <cbrewster@hey.com> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/glue/src')
-rw-r--r-- | tvix/glue/src/tvix_store_io.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs index 30ab97c0ca03..e768e1475c94 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<Option<Node>> { - 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<S>(&self, entries_stream: S) -> io::Result<Node> @@ -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. |