|
|
@ -108,11 +108,12 @@ impl<'env, T> TransactionExt<'env> for T where T: Transaction<'env> {} |
|
|
|
/// An LMDB read-only transaction.
|
|
|
|
/// An LMDB read-only transaction.
|
|
|
|
pub struct RoTransaction<'env> { |
|
|
|
pub struct RoTransaction<'env> { |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
_no_sync: marker::NoSync, |
|
|
|
_marker: marker::ContravariantLifetime<'env>, |
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime<'env>, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl <'env> !Sync for RoTransaction<'env> {} |
|
|
|
|
|
|
|
impl <'env> !Send for RoTransaction<'env> {} |
|
|
|
|
|
|
|
|
|
|
|
#[unsafe_destructor] |
|
|
|
#[unsafe_destructor] |
|
|
|
impl <'env> Drop for RoTransaction<'env> { |
|
|
|
impl <'env> Drop for RoTransaction<'env> { |
|
|
|
fn drop(&mut self) { |
|
|
|
fn drop(&mut self) { |
|
|
@ -132,12 +133,7 @@ impl <'env> RoTransaction<'env> { |
|
|
|
ptr::null_mut(), |
|
|
|
ptr::null_mut(), |
|
|
|
ffi::MDB_RDONLY, |
|
|
|
ffi::MDB_RDONLY, |
|
|
|
&mut txn))); |
|
|
|
&mut txn))); |
|
|
|
Ok(RoTransaction { |
|
|
|
Ok(RoTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> }) |
|
|
|
txn: txn, |
|
|
|
|
|
|
|
_no_sync: marker::NoSync, |
|
|
|
|
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime::<'env>, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -157,12 +153,7 @@ impl <'env> RoTransaction<'env> { |
|
|
|
mem::forget(self); |
|
|
|
mem::forget(self); |
|
|
|
ffi::mdb_txn_reset(txn) |
|
|
|
ffi::mdb_txn_reset(txn) |
|
|
|
}; |
|
|
|
}; |
|
|
|
InactiveTransaction { |
|
|
|
InactiveTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> } |
|
|
|
txn: txn, |
|
|
|
|
|
|
|
_no_sync: marker::NoSync, |
|
|
|
|
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime::<'env>, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -175,9 +166,7 @@ impl <'env> Transaction<'env> for RoTransaction<'env> { |
|
|
|
/// An inactive read-only transaction.
|
|
|
|
/// An inactive read-only transaction.
|
|
|
|
pub struct InactiveTransaction<'env> { |
|
|
|
pub struct InactiveTransaction<'env> { |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
_no_sync: marker::NoSync, |
|
|
|
_marker: marker::ContravariantLifetime<'env>, |
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime<'env>, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[unsafe_destructor] |
|
|
|
#[unsafe_destructor] |
|
|
@ -199,23 +188,19 @@ impl <'env> InactiveTransaction<'env> { |
|
|
|
mem::forget(self); |
|
|
|
mem::forget(self); |
|
|
|
try!(lmdb_result(ffi::mdb_txn_renew(txn))) |
|
|
|
try!(lmdb_result(ffi::mdb_txn_renew(txn))) |
|
|
|
}; |
|
|
|
}; |
|
|
|
Ok(RoTransaction { |
|
|
|
Ok(RoTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> }) |
|
|
|
txn: txn, |
|
|
|
|
|
|
|
_no_sync: marker::NoSync, |
|
|
|
|
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime::<'env>, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// An LMDB read-write transaction.
|
|
|
|
/// An LMDB read-write transaction.
|
|
|
|
pub struct RwTransaction<'env> { |
|
|
|
pub struct RwTransaction<'env> { |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
txn: *mut ffi::MDB_txn, |
|
|
|
_no_sync: marker::NoSync, |
|
|
|
_marker: marker::ContravariantLifetime<'env>, |
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime<'env>, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl <'env> !Sync for RwTransaction<'env> {} |
|
|
|
|
|
|
|
impl <'env> !Send for RwTransaction<'env> {} |
|
|
|
|
|
|
|
|
|
|
|
#[unsafe_destructor] |
|
|
|
#[unsafe_destructor] |
|
|
|
impl <'env> Drop for RwTransaction<'env> { |
|
|
|
impl <'env> Drop for RwTransaction<'env> { |
|
|
|
fn drop(&mut self) { |
|
|
|
fn drop(&mut self) { |
|
|
@ -235,12 +220,7 @@ impl <'env> RwTransaction<'env> { |
|
|
|
ptr::null_mut(), |
|
|
|
ptr::null_mut(), |
|
|
|
EnvironmentFlags::empty().bits(), |
|
|
|
EnvironmentFlags::empty().bits(), |
|
|
|
&mut txn))); |
|
|
|
&mut txn))); |
|
|
|
Ok(RwTransaction { |
|
|
|
Ok(RwTransaction { txn: txn, _marker: marker::ContravariantLifetime::<'env> }) |
|
|
|
txn: txn, |
|
|
|
|
|
|
|
_no_sync: marker::NoSync, |
|
|
|
|
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime::<'env>, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -372,12 +352,7 @@ impl <'env> RwTransaction<'env> { |
|
|
|
let env: *mut ffi::MDB_env = ffi::mdb_txn_env(self.txn()); |
|
|
|
let env: *mut ffi::MDB_env = ffi::mdb_txn_env(self.txn()); |
|
|
|
ffi::mdb_txn_begin(env, self.txn(), 0, &mut nested); |
|
|
|
ffi::mdb_txn_begin(env, self.txn(), 0, &mut nested); |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(RwTransaction { |
|
|
|
Ok(RwTransaction { txn: nested, _marker: marker::ContravariantLifetime::<'env> }) |
|
|
|
txn: nested, |
|
|
|
|
|
|
|
_no_sync: marker::NoSync, |
|
|
|
|
|
|
|
_no_send: marker::NoSend, |
|
|
|
|
|
|
|
_contravariant: marker::ContravariantLifetime::<'env>, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|