Skip to content

Commit

Permalink
Reintroduce RoTxn::commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel Viala committed Jul 5, 2023
1 parent 802192e commit e2e8516
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions heed/src/txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ impl<'e> RoTxn<'e> {
pub(crate) fn env_mut_ptr(&self) -> *mut ffi::MDB_env {
self.env.env_mut_ptr()
}

pub fn commit(mut self) -> Result<()> {
let result = unsafe { mdb_result(ffi::mdb_txn_commit(self.txn)) };
self.txn = ptr::null_mut();
result.map_err(Into::into)
}
}

impl Drop for RoTxn<'_> {
Expand Down

0 comments on commit e2e8516

Please sign in to comment.