small cleanup

redo-gragh
Avril 3 years ago
parent 0e7ad1afb4
commit 0b55df9b91
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,5 +1,5 @@
use super::*;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::collections::HashMap;
use std::io;
@ -15,12 +15,6 @@ use data::FsInfo;
use state::State;
use data::INodeInfoGraph;
/// Join a root path onto this hashmap.
fn join_root<'a>(root: impl AsRef<Path> + 'a, map: HashMap<PathBuf, INode>) -> impl Iterator<Item=(PathBuf, INode)> + 'a
{
map.into_iter().map(move |(k, v)| (root.as_ref().join(k), v))
}
async fn process_entry(entry: &tokio::fs::DirEntry, parent: INode) -> io::Result<FsInfo>
{
let meta = entry.metadata().await?;
@ -50,7 +44,6 @@ pub async fn work_on_all(state: State) -> INodeInfoGraph
let inode = meta.inode();
tokio::spawn(walk(state.clone(), path, inode)).await
.ok()
//.map(move |res| (res, path))
},
Err(err) => {
eprintln!("Failed to stat root {:?}: {}", path, err);
@ -72,19 +65,7 @@ pub async fn work_on_all(state: State) -> INodeInfoGraph
if let Some(res) = path_comp
{
output.extend(res);
/*
for (path, ino) in res.into_iter()
{
// If this inode is not in the map, this is a top-level path.
//if let Some(_) = ino_map.get(&ino) {
output.insert(path, ino); //XXX: Why does `output` always end up empty???
//} else {
// eprintln!("No ino entry for {:?} ({:?})", path, ino);
//}
}*/
}
}
@ -153,7 +134,7 @@ fn walk(state: State, root: PathBuf, root_ino: INode) -> BoxFuture<'static, Hash
{
if let Ok(map) = child
{
output.extend(map);//join_root(&root, map));
output.extend(map);
} else {
eprintln!("Child panic");
}

Loading…
Cancel
Save