refactor(tvix): remove usage of async-recursion
Rust 1.77 supports async recursion as long as there is some form of indirection (ie. `Box::pin`). This removes the need to use the async-recursion crate. Change-Id: Ic9613ab7f32016f0103032a861edff92e2fb8b41 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11596 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
01a4a2399c
commit
da9bc274f3
8 changed files with 19 additions and 68 deletions
13
tvix/Cargo.lock
generated
13
tvix/Cargo.lock
generated
|
@ -206,17 +206,6 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-recursion"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-signal"
|
||||
version = "0.2.5"
|
||||
|
@ -4387,7 +4376,6 @@ name = "tvix-glue"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"async-recursion",
|
||||
"bstr",
|
||||
"bytes",
|
||||
"criterion",
|
||||
|
@ -4438,7 +4426,6 @@ dependencies = [
|
|||
"anyhow",
|
||||
"async-compression",
|
||||
"async-process",
|
||||
"async-recursion",
|
||||
"async-stream",
|
||||
"bigtable_rs",
|
||||
"blake3",
|
||||
|
|
|
@ -718,35 +718,6 @@ rec {
|
|||
}
|
||||
];
|
||||
|
||||
};
|
||||
"async-recursion" = rec {
|
||||
crateName = "async-recursion";
|
||||
version = "1.0.5";
|
||||
edition = "2018";
|
||||
sha256 = "1l2vlgyaa9a2dd0y1vbqyppzsvpdr1y4rar4gn1qi68pl5dmmmaz";
|
||||
procMacro = true;
|
||||
authors = [
|
||||
"Robert Usher <266585+dcchut@users.noreply.github.com>"
|
||||
];
|
||||
dependencies = [
|
||||
{
|
||||
name = "proc-macro2";
|
||||
packageId = "proc-macro2";
|
||||
usesDefaultFeatures = false;
|
||||
}
|
||||
{
|
||||
name = "quote";
|
||||
packageId = "quote";
|
||||
usesDefaultFeatures = false;
|
||||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
usesDefaultFeatures = false;
|
||||
features = [ "full" "parsing" "printing" "proc-macro" "clone-impls" ];
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
"async-signal" = rec {
|
||||
crateName = "async-signal";
|
||||
|
@ -14098,10 +14069,6 @@ rec {
|
|||
packageId = "async-compression";
|
||||
features = [ "tokio" "gzip" "bzip2" "xz" ];
|
||||
}
|
||||
{
|
||||
name = "async-recursion";
|
||||
packageId = "async-recursion";
|
||||
}
|
||||
{
|
||||
name = "bstr";
|
||||
packageId = "bstr";
|
||||
|
@ -14300,10 +14267,6 @@ rec {
|
|||
packageId = "async-compression";
|
||||
features = [ "tokio" "bzip2" "gzip" "xz" "zstd" ];
|
||||
}
|
||||
{
|
||||
name = "async-recursion";
|
||||
packageId = "async-recursion";
|
||||
}
|
||||
{
|
||||
name = "async-stream";
|
||||
packageId = "async-stream";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"git+https://github.com/flokli/bigtable_rs?rev=0af404741dfc40eb9fa99cf4d4140a09c5c20df7#0.2.9": "1njjam1lx2xlnm7a41lga8601vmjgqz0fvc77x24gd04pc7avxll",
|
||||
"git+https://github.com/tvlfyi/wu-manber.git#wu-manber@0.1.0": "1zhk83lbq99xzyjwphv2qrb8f8qgfqwa5bbbvyzm0z0bljsjv0pd"
|
||||
"bigtable_rs 0.2.9 (git+https://github.com/flokli/bigtable_rs?rev=0af404741dfc40eb9fa99cf4d4140a09c5c20df7#0af404741dfc40eb9fa99cf4d4140a09c5c20df7)": "1njjam1lx2xlnm7a41lga8601vmjgqz0fvc77x24gd04pc7avxll",
|
||||
"wu-manber 0.1.0 (git+https://github.com/tvlfyi/wu-manber.git#0d5b22bea136659f7de60b102a7030e0daaa503d)": "1zhk83lbq99xzyjwphv2qrb8f8qgfqwa5bbbvyzm0z0bljsjv0pd"
|
||||
}
|
|
@ -5,7 +5,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
async-compression = { version = "0.4.9", features = ["tokio", "gzip", "bzip2", "xz"]}
|
||||
async-recursion = "1.0.5"
|
||||
bstr = "1.6.0"
|
||||
bytes = "1.4.0"
|
||||
data-encoding = "2.3.3"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//! This module provides an implementation of EvalIO talking to tvix-store.
|
||||
|
||||
use async_recursion::async_recursion;
|
||||
use bytes::Bytes;
|
||||
use futures::{StreamExt, TryStreamExt};
|
||||
use nix_compat::nixhash::NixHash;
|
||||
|
@ -92,7 +91,6 @@ impl TvixStoreIO {
|
|||
///
|
||||
/// In case there is no PathInfo yet, this means we need to build it
|
||||
/// (which currently is stubbed out still).
|
||||
#[async_recursion(?Send)]
|
||||
#[instrument(skip(self, store_path), fields(store_path=%store_path), ret(level = Level::TRACE), err)]
|
||||
async fn store_path_to_node(
|
||||
&self,
|
||||
|
|
|
@ -40,7 +40,6 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter", "json"] }
|
|||
tvix-castore = { path = "../castore" }
|
||||
url = "2.4.0"
|
||||
walkdir = "2.4.0"
|
||||
async-recursion = "1.0.5"
|
||||
reqwest = { version = "0.11.22", features = ["rustls-tls-native-roots", "stream"], default-features = false }
|
||||
|
||||
[dependencies.tonic-reflection]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use async_recursion::async_recursion;
|
||||
use nix_compat::nar::reader::r#async as nar_reader;
|
||||
use tokio::{io::AsyncBufRead, sync::mpsc, try_join};
|
||||
use tvix_castore::{
|
||||
|
@ -54,10 +53,9 @@ where
|
|||
Ok(node.rename("".into()))
|
||||
}
|
||||
|
||||
#[async_recursion]
|
||||
async fn produce_nar_inner<'a: 'async_recursion, 'r: 'async_recursion, BS>(
|
||||
async fn produce_nar_inner<BS>(
|
||||
blob_service: BS,
|
||||
node: nar_reader::Node<'a, 'r>,
|
||||
node: nar_reader::Node<'_, '_>,
|
||||
path: PathBuf,
|
||||
tx: mpsc::Sender<Result<IngestionEntry, Error>>,
|
||||
) -> Result<IngestionEntry, Error>
|
||||
|
@ -93,8 +91,13 @@ where
|
|||
path.try_push(&entry.name)
|
||||
.expect("Tvix bug: failed to join name");
|
||||
|
||||
let entry =
|
||||
produce_nar_inner(blob_service.clone(), entry.node, path, tx.clone()).await?;
|
||||
let entry = Box::pin(produce_nar_inner(
|
||||
blob_service.clone(),
|
||||
entry.node,
|
||||
path,
|
||||
tx.clone(),
|
||||
))
|
||||
.await?;
|
||||
|
||||
tx.send(Ok(entry)).await.map_err(|e| {
|
||||
Error::IO(std::io::Error::new(std::io::ErrorKind::BrokenPipe, e))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use crate::utils::AsyncIoBridge;
|
||||
|
||||
use super::RenderError;
|
||||
use async_recursion::async_recursion;
|
||||
use count_write::CountWrite;
|
||||
use nix_compat::nar::writer::r#async as nar_writer;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
@ -72,9 +71,8 @@ where
|
|||
|
||||
/// Process an intermediate node in the structure.
|
||||
/// This consumes the node.
|
||||
#[async_recursion]
|
||||
async fn walk_node<BS, DS>(
|
||||
nar_node: nar_writer::Node<'async_recursion, '_>,
|
||||
nar_node: nar_writer::Node<'_, '_>,
|
||||
proto_node: &castorepb::node::Node,
|
||||
blob_service: BS,
|
||||
directory_service: DS,
|
||||
|
@ -164,8 +162,12 @@ where
|
|||
.await
|
||||
.map_err(RenderError::NARWriterError)?;
|
||||
|
||||
(blob_service, directory_service) =
|
||||
walk_node(child_node, &proto_node, blob_service, directory_service)
|
||||
(blob_service, directory_service) = Box::pin(walk_node(
|
||||
child_node,
|
||||
&proto_node,
|
||||
blob_service,
|
||||
directory_service,
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue