Struct sanakirja::MutTxn[][src]

pub struct MutTxn<E: Borrow<Env>, T> { /* fields omitted */ }
Expand description

A mutable transaction.

Implementations

impl<E: Borrow<Env>, T> MutTxn<E, T>[src]

pub fn set_root(&mut self, num: usize, value: u64)[src]

Setting the numth 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.

pub fn remove_root(&mut self, num: usize)[src]

Setting the numth element of the initial page, treated as a [u64; 510].

impl<E: Borrow<Env>, A> MutTxn<E, A>[src]

pub unsafe fn root_page_mut(&mut self) -> &mut [u8; 4064][src]

The root page of this transaction (use with caution, this page contains root databases).

pub unsafe fn root_page(&mut self) -> &[u8; 4064][src]

The root page of this transaction.

impl<E: Borrow<Env>, T> MutTxn<E, T>[src]

pub fn root(&self, n: usize) -> Option<u64>[src]

Low-level method to get the root page number n, if that page isn’t a B tree (use the RootDb trait else).

Trait Implementations

impl<E: Borrow<Env>, T> AllocPage for MutTxn<E, T>[src]

fn alloc_page(&mut self) -> Result<MutPage, Error>[src]

Allocate a single page.

fn incr_rc(&mut self, off: u64) -> Result<usize, Error>[src]

Increment the reference count for page off.

fn decr_rc(&mut self, off: u64) -> Result<usize, Error>[src]

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). Read more

fn decr_rc_owned(&mut self, off: u64) -> Result<usize, Error>[src]

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. Read more

impl<'a, E: Borrow<Env>, T> Commit for MutTxn<E, &'a mut MutTxn<E, T>>[src]

The following is very easy, we’re just extending all values of the current transaction with values of the subtransaction.

fn commit(self) -> Result<(), Error>[src]

Commit the transaction.

impl<E: Borrow<Env>> Commit for MutTxn<E, ()>[src]

fn commit(self) -> Result<(), Error>[src]

Commit the transaction.

impl<E: Borrow<Env>, T> Debug for MutTxn<E, T>[src]

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<E: Borrow<Env>, T> Drop for MutTxn<E, T>[src]

When dropping a transaction, we need to unlock the read-write locks internal to this process, and possibly the file locks.

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<E: Borrow<Env>, A> LoadPage for MutTxn<E, A>[src]

type Error = Error

fn load_page(&self, off: u64) -> Result<CowPage, Self::Error>[src]

Loading a page.

fn rc(&self, page: u64) -> Result<u64, Self::Error>[src]

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

impl<E: Borrow<Env>, T> RootDb for MutTxn<E, T>[src]

fn root_db<K: Storable + ?Sized, V: Storable + ?Sized, P: BTreePage<K, V>>(
    &self,
    n: usize
) -> Option<Db_<K, V, P>>
[src]

Return the database stored in the root page of the current transaction at index n, if any. Read more

Auto Trait Implementations

impl<E, T> RefUnwindSafe for MutTxn<E, T> where
    E: RefUnwindSafe,
    T: RefUnwindSafe

impl<E, T> Send for MutTxn<E, T> where
    E: Send,
    T: Send

impl<E, T> Sync for MutTxn<E, T> where
    E: Sync,
    T: Sync

impl<E, T> Unpin for MutTxn<E, T> where
    E: Unpin,
    T: Unpin

impl<E, T> UnwindSafe for MutTxn<E, T> where
    E: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.