pub struct MutTxn<E: Borrow<Env>, T> { /* private fields */ }
Expand description
A mutable transaction.
Implementations§
source§impl<E: Borrow<Env>, T> MutTxn<E, T>
impl<E: Borrow<Env>, T> MutTxn<E, T>
sourcepub fn set_root(&mut self, num: usize, value: u64)
pub fn set_root(&mut self, num: usize, value: u64)
Setting the num
th element of the initial page, treated as a
[u64; 510]
, to value
. This doesn’t actually write anything
to that page, since that page is written during the commit.
In the current implementation, value
is probably going to be
the offset in the file of the root page of a B tree.
sourcepub fn remove_root(&mut self, num: usize)
pub fn remove_root(&mut self, num: usize)
Setting the num
th element of the initial page, treated as a
[u64; 510].
Trait Implementations§
source§impl<E: Borrow<Env>, T> AllocPage for MutTxn<E, T>
impl<E: Borrow<Env>, T> AllocPage for MutTxn<E, T>
source§unsafe fn alloc_contiguous(&mut self, length: u64) -> Result<MutPage, Error>
unsafe fn alloc_contiguous(&mut self, length: u64) -> Result<MutPage, Error>
Allocate many contiguous pages, return the first one
source§fn incr_rc(&mut self, off: u64) -> Result<usize, Error>
fn incr_rc(&mut self, off: u64) -> Result<usize, Error>
Increment the reference count for page off
.
source§unsafe fn decr_rc(&mut self, off: u64) -> Result<usize, Error>
unsafe fn decr_rc(&mut self, off: u64) -> Result<usize, Error>
Decrement the page’s reference count, assuming the page was
first allocated by another transaction. If the RC reaches 0,
free the page. Must return the new RC (0 if freed).
source§unsafe fn decr_rc_owned(&mut self, off: u64) -> Result<usize, Error>
unsafe fn decr_rc_owned(&mut self, off: u64) -> Result<usize, Error>
Same as
Self::decr_rc
, but for pages allocated by the current
transaction. This is an important distinction, as pages
allocated by the current transaction can be reused immediately
after being freed.source§impl<'a, E: Borrow<Env>, T> Commit for MutTxn<E, &'a mut MutTxn<E, T>>
impl<'a, E: Borrow<Env>, T> Commit for MutTxn<E, &'a mut MutTxn<E, T>>
The following is very easy, we’re just extending all values of the current transaction with values of the subtransaction.
source§impl<E: Borrow<Env>, T> Drop for MutTxn<E, T>
impl<E: Borrow<Env>, T> Drop for MutTxn<E, T>
When dropping a transaction, we need to unlock the read-write locks internal to this process, and possibly the file locks.
source§impl<E: Borrow<Env>, A> LoadPage for MutTxn<E, A>
impl<E: Borrow<Env>, A> LoadPage for MutTxn<E, A>
type Error = Error
source§fn rc(&self, page: u64) -> Result<u64, Self::Error>
fn rc(&self, page: u64) -> Result<u64, Self::Error>
Reference-counting. Since reference-counts are designed to be
storable into B trees by external allocators, pages referenced
once aren’t stored, and hence are indistinguishable from pages
that are never referenced. The default implementation returns
0. Read more
Auto Trait Implementations§
impl<E, T> Freeze for MutTxn<E, T>
impl<E, T> RefUnwindSafe for MutTxn<E, T>where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<E, T> Send for MutTxn<E, T>
impl<E, T> Sync for MutTxn<E, T>
impl<E, T> Unpin for MutTxn<E, T>
impl<E, T> UnwindSafe for MutTxn<E, T>where
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more