refactor(tvix/store): infer more types
We don't need to explicitly describe the type of the task itself, describing the return type of the async closure is sufficient. Also, use io::Result<_> instead of Result<_, io::Error>. Change-Id: I9ab3f990eb49929b0aea335b2bb07da392ab631f Reviewed-on: https://cl.tvl.fyi/c/depot/+/9267 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
7bd3c42c74
commit
e41b5ae3f0
1 changed files with 41 additions and 44 deletions
|
@ -191,8 +191,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let directory_service = directory_service.clone();
|
||||
let path_info_service = path_info_service.clone();
|
||||
|
||||
let task: tokio::task::JoinHandle<Result<(), io::Error>> =
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let task = tokio::task::spawn_blocking(move || -> io::Result<()> {
|
||||
// Ingest the path into blob and directory service.
|
||||
let root_node = import::ingest_path(
|
||||
blob_service.clone(),
|
||||
|
@ -202,8 +201,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.expect("failed to ingest path");
|
||||
|
||||
// Ask the PathInfoService for the NAR size and sha256
|
||||
let (nar_size, nar_sha256) =
|
||||
path_info_service.calculate_nar(&root_node)?;
|
||||
let (nar_size, nar_sha256) = path_info_service.calculate_nar(&root_node)?;
|
||||
|
||||
// TODO: make a path_to_name helper function?
|
||||
let name = path
|
||||
|
@ -212,8 +210,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.to_str()
|
||||
.expect("path must be valid unicode");
|
||||
|
||||
let output_path =
|
||||
store_path::build_nar_based_store_path(&nar_sha256, name);
|
||||
let output_path = store_path::build_nar_based_store_path(&nar_sha256, name);
|
||||
|
||||
// assemble a new root_node with a name that is derived from the nar hash.
|
||||
let root_node =
|
||||
|
@ -243,7 +240,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
});
|
||||
task
|
||||
})
|
||||
.collect::<Vec<tokio::task::JoinHandle<Result<(), io::Error>>>>();
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
try_join_all(tasks).await?;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue