|
|
@ -25,7 +25,7 @@ async fn process_entry(entry: &tokio::fs::DirEntry, parent: INode) -> io::Result
|
|
|
|
let meta = entry.metadata().await?;
|
|
|
|
let meta = entry.metadata().await?;
|
|
|
|
if meta.is_dir()
|
|
|
|
if meta.is_dir()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Ok(FsInfo::Directory)
|
|
|
|
Ok(FsInfo::Directory(parent))
|
|
|
|
} else if meta.is_file()
|
|
|
|
} else if meta.is_file()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Ok(FsInfo::File(meta.len(), parent))
|
|
|
|
Ok(FsInfo::File(meta.len(), parent))
|
|
|
@ -35,17 +35,17 @@ async fn process_entry(entry: &tokio::fs::DirEntry, parent: INode) -> io::Result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Contains a graph of all paths and inodes that were successfully stat
|
|
|
|
/// Contains a graph of all paths and inodes that were successfully stat'd
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
|
pub struct INodeInfoGraph
|
|
|
|
pub struct INodeInfoGraph
|
|
|
|
{
|
|
|
|
{
|
|
|
|
inodes: HashMap<INode, FsInfo>, // FsInfo `file` contains parent INode that can be used to look up again in this table
|
|
|
|
inodes: HashMap<INode, FsInfo>, // FsInfo contains parent INode that can be used to look up again in this table
|
|
|
|
paths: HashMap<PathBuf, INode>, // map absolute paths to INodes to be looked up in `inodes` table.
|
|
|
|
paths: HashMap<PathBuf, INode>, // map absolute paths to INodes to be looked up in `inodes` table.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl INodeInfoGraph
|
|
|
|
impl INodeInfoGraph
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//TODO: Order by largest size
|
|
|
|
//TODO: Order by largest size, get and iter fns etc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Walk on all paths in this state, then return a joined map of all
|
|
|
|
/// Walk on all paths in this state, then return a joined map of all
|
|
|
|