diff --git a/src/store/local.rs b/src/store/local.rs index 89ff8b8..ff8bb7a 100644 --- a/src/store/local.rs +++ b/src/store/local.rs @@ -508,11 +508,11 @@ impl LocalRecord { impl Store for LocalStore { fn get_creds(&self, specifier: &String, key: &String) -> Option { match self.btree_find_key(&key) { - Some(x) => { + (Some(x), _) => { println!("Found: {}", x); todo!() } - None => return None, + (None, _) => return None, } } @@ -620,7 +620,7 @@ impl LocalStore { node } - fn btree_find_key(&self, key: &String) -> Option { + fn btree_find_key(&self, key: &String) -> (Option, Vec) { let mut file: BufReader = BufReader::new(File::open(&self.path).expect("Cannot open file")); @@ -630,6 +630,8 @@ impl LocalStore { hasher.finish() }; + let mut traversal_history = Vec::new(); + let pos = file.seek(SeekFrom::Start(0x90)).unwrap(); let mut block = self .enc_ctx @@ -637,6 +639,7 @@ impl LocalStore { .unwrap(); loop { + traversal_history.push(block.stream_position().unwrap()); let node = self.read_node(&mut block); if node.node_type == IndexNodeType::Invalid { @@ -649,10 +652,10 @@ impl LocalStore { if node.node_type == IndexNodeType::Leaf { for child in node.children() { if child.key == hash { - return Some(child.pointer); + return (Some(child.pointer), traversal_history); } } - return None; + return (None, traversal_history); } for child in node.children {