MCPcopy Create free account
hub / github.com/hashintel/hash / in_transaction

Method in_transaction

libs/@local/hashql/core/src/module/namespace.rs:430–447  ·  view source on GitHub ↗
(&mut self, closure: impl FnOnce(&mut Self) -> Transaction<T>)

Source from the content-addressed store, hash-verified

428 }
429
430 pub fn in_transaction<T>(&mut self, closure: impl FnOnce(&mut Self) -> Transaction<T>) -> T {
431 let snapshot = self.imports.start_snapshot();
432
433 let transaction = closure(self);
434
435 match transaction {
436 Transaction::Commit(value) => {
437 self.imports.commit(snapshot);
438
439 value
440 }
441 Transaction::Rollback(value) => {
442 self.imports.rollback_to(snapshot);
443
444 value
445 }
446 }
447 }
448
449 #[cfg(test)]
450 pub(crate) fn imports_as_slice(&self) -> &[Import<'heap>] {

Callers

nothing calls this directly

Calls 2

commitMethod · 0.45
rollback_toMethod · 0.45

Tested by

no test coverage detected