|
|
@ -126,8 +126,7 @@ impl <'env> RoTransaction<'env> { |
|
|
|
|
|
|
|
|
|
|
|
/// Creates a new read-only transaction in the given environment. Prefer
|
|
|
|
/// Creates a new read-only transaction in the given environment. Prefer
|
|
|
|
/// using `Environment::begin_ro_txn`.
|
|
|
|
/// using `Environment::begin_ro_txn`.
|
|
|
|
#[doc(hidden)] |
|
|
|
pub(crate) fn new(env: &'env Environment) -> Result<RoTransaction<'env>> { |
|
|
|
pub fn new(env: &'env Environment) -> Result<RoTransaction<'env>> { |
|
|
|
|
|
|
|
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); |
|
|
|
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
lmdb_result(ffi::mdb_txn_begin(env.env(), ptr::null_mut(), ffi::MDB_RDONLY, &mut txn))?; |
|
|
|
lmdb_result(ffi::mdb_txn_begin(env.env(), ptr::null_mut(), ffi::MDB_RDONLY, &mut txn))?; |
|
|
@ -220,8 +219,7 @@ impl <'env> RwTransaction<'env> { |
|
|
|
|
|
|
|
|
|
|
|
/// Creates a new read-write transaction in the given environment. Prefer
|
|
|
|
/// Creates a new read-write transaction in the given environment. Prefer
|
|
|
|
/// using `Environment::begin_ro_txn`.
|
|
|
|
/// using `Environment::begin_ro_txn`.
|
|
|
|
#[doc(hidden)] |
|
|
|
pub(crate) fn new(env: &'env Environment) -> Result<RwTransaction<'env>> { |
|
|
|
pub fn new(env: &'env Environment) -> Result<RwTransaction<'env>> { |
|
|
|
|
|
|
|
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); |
|
|
|
let mut txn: *mut ffi::MDB_txn = ptr::null_mut(); |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
lmdb_result(ffi::mdb_txn_begin(env.env(), |
|
|
|
lmdb_result(ffi::mdb_txn_begin(env.env(), |
|
|
@ -244,7 +242,7 @@ impl <'env> RwTransaction<'env> { |
|
|
|
///
|
|
|
|
///
|
|
|
|
/// ## Safety
|
|
|
|
/// ## Safety
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// * This function (as well as `Environment::open_db`,
|
|
|
|
/// This function (as well as `Environment::open_db`,
|
|
|
|
/// `Environment::create_db`, and `Database::open`) **must not** be called
|
|
|
|
/// `Environment::create_db`, and `Database::open`) **must not** be called
|
|
|
|
/// from multiple concurrent transactions in the same environment. A
|
|
|
|
/// from multiple concurrent transactions in the same environment. A
|
|
|
|
/// transaction which uses this function must finish (either commit or
|
|
|
|
/// transaction which uses this function must finish (either commit or
|
|
|
|