|
|
|
@ -162,39 +162,13 @@ impl HierarchicalINodeGraph
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fn create_from(graph: &INodeInfoGraph) -> Self
|
|
|
|
|
{
|
|
|
|
|
let mut new = Self {
|
|
|
|
|
table: HashMap::with_capacity(graph.inodes.len()),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (path, &inode) in graph.paths.iter()
|
|
|
|
|
#[inline(always)] fn create(graph: INodeInfoGraph) -> Self
|
|
|
|
|
{
|
|
|
|
|
//Lookup the INode in graph inode table
|
|
|
|
|
if let Some(fsinfo) = graph.inodes.get(&inode)
|
|
|
|
|
{
|
|
|
|
|
match fsinfo {
|
|
|
|
|
FsInfo::File(sz, parent) => {
|
|
|
|
|
new.table.insert(path.clone(), HierarchicalNode {
|
|
|
|
|
kind: NodeKind::File(*sz),
|
|
|
|
|
inode,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
FsInfo::Directory(parent) => {
|
|
|
|
|
new.table.insert(path.clone(), HierarchicalNode {
|
|
|
|
|
kind: NodeKind::Directory(graph.children.get(&inode).unwrap().iter().map(|node| {
|
|
|
|
|
graph.paths_reverse.get(node).unwrap().clone()
|
|
|
|
|
}).collect(), None),
|
|
|
|
|
inode,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
//eh...
|
|
|
|
|
Self::create_from(&graph)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new
|
|
|
|
|
}
|
|
|
|
|
fn create(graph: INodeInfoGraph) -> Self
|
|
|
|
|
fn create_from(graph: &INodeInfoGraph) -> Self
|
|
|
|
|
{
|
|
|
|
|
let mut new = Self {
|
|
|
|
|
table: HashMap::with_capacity(graph.inodes.len()),
|
|
|
|
|