MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / drop

Method drop

sdk-rust/src/transaction.rs:241–268  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

239
240impl<'conn> Drop for Transaction<'conn> {
241 fn drop(&mut self) {
242 if self.committed {
243 return; // Already committed or rolled back
244 }
245
246 match self.drop_behavior {
247 DropBehavior::Rollback => {
248 // Attempt to rollback, log error if it fails
249 if let Err(e) = self.rollback_internal() {
250 eprintln!("Warning: Failed to rollback transaction on drop: {}", e);
251 }
252 }
253 DropBehavior::Commit => {
254 // Attempt to commit, log error if it fails
255 if let Err(e) = self.commit_internal() {
256 eprintln!("Warning: Failed to commit transaction on drop: {}", e);
257 }
258 }
259 DropBehavior::Panic => {
260 if !std::thread::panicking() {
261 panic!("Transaction dropped without explicit commit or rollback");
262 }
263 }
264 DropBehavior::Ignore => {
265 // Do nothing
266 }
267 }
268 }
269}
270
271#[cfg(test)]

Callers

nothing calls this directly

Calls 2

rollback_internalMethod · 0.80
commit_internalMethod · 0.80

Tested by

no test coverage detected