MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / try_remove

Method try_remove

rust/src/lib.rs:80–94  ·  view source on GitHub ↗

Remove with comprehensive error handling

(&mut self, key: &K)

Source from the content-addressed store, hash-verified

78
79 /// Remove with comprehensive error handling
80 pub fn try_remove(&mut self, key: &K) -> ModifyResult<V> {
81 // Validate tree state before removal
82 if let Err(e) = self.check_invariants_detailed() {
83 return Err(BPlusTreeError::DataIntegrityError(e));
84 }
85
86 let value = self.remove(key).ok_or(BPlusTreeError::KeyNotFound)?;
87
88 // Validate tree state after removal
89 if let Err(e) = self.check_invariants_detailed() {
90 return Err(BPlusTreeError::DataIntegrityError(e));
91 }
92
93 Ok(value)
94 }
95
96 /// Batch insert operations with rollback on any failure
97 pub fn batch_insert(&mut self, items: Vec<(K, V)>) -> ModifyResult<Vec<Option<V>>>

Calls 2

removeMethod · 0.45

Tested by 2