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 <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-03-28 21:58:17 +01:00 committed by flokli
parent 6e8046bec7
commit f1e6f98072

View file

@ -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.