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

Method commit_transaction

graphlite/src/session/transaction_state.rs:129–151  ·  view source on GitHub ↗

Commit the current transaction

(&self)

Source from the content-addressed store, hash-verified

127
128 /// Commit the current transaction
129 pub fn commit_transaction(&self) -> Result<(), ExecutionError> {
130 let txn_id = self.current_transaction_id()?.ok_or_else(|| {
131 ExecutionError::RuntimeError("No active transaction to commit".to_string())
132 })?;
133
134 // Commit the transaction
135 self.manager.commit_transaction(txn_id)?;
136
137 // Clear current transaction
138 let mut current = self.current_transaction.write().map_err(|_| {
139 ExecutionError::RuntimeError("Failed to update transaction state".to_string())
140 })?;
141 *current = None;
142
143 // Clear transaction log
144 let mut logs = self.transaction_logs.write().map_err(|_| {
145 ExecutionError::RuntimeError("Failed to update transaction logs".to_string())
146 })?;
147 logs.remove(&txn_id);
148
149 log::info!("Session committed transaction: {:?}", txn_id);
150 Ok(())
151 }
152
153 /// Rollback the current transaction
154 pub fn rollback_transaction(&self) -> Result<(), ExecutionError> {

Callers 1

Calls 2

removeMethod · 0.45

Tested by

no test coverage detected