MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / has_key_node

Method has_key_node

src/structures/mmap_tree.rs:199–209  ·  view source on GitHub ↗
(&mut self, node_offset: usize, key: K)

Source from the content-addressed store, hash-verified

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();

Callers 1

has_keyMethod · 0.80

Calls 1

load_nodeMethod · 0.80

Tested by

no test coverage detected