| 197 | } |
| 198 | |
| 199 | pub fn has_key_node(&mut self, node_offset: usize, key: K) -> Result<bool, io::Error> { |
| 200 | let node = self.storage_manager.load_node(node_offset)?; |
| 201 | |
| 202 | match node.node_type { |
| 203 | NodeType::Internal => { |
| 204 | let idx = node.keys.binary_search(&key).unwrap_or_else(|x| x); // Find the child to go to |
| 205 | self.has_key_node(node.children[idx], key) |
| 206 | } |
| 207 | NodeType::Leaf => Ok(node.keys.binary_search(&key).into_iter().next().is_some()), |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | pub fn get_range(&mut self, start: K, end: K) -> Result<Vec<(K, V)>, io::Error> { |
| 212 | let mut result = Vec::new(); |