Struct sanakirja_core::btree::page::Page

source ·
pub struct Page<K, V> { /* private fields */ }
Expand description

Empty type implementing BTreePage and BTreeMutPage.

Trait Implementations§

source§

impl<K: Storable + Debug, V: Storable + Debug> BTreeMutPage<K, V> for Page<K, V>

source§

fn init(page: &mut MutPage)

Initialise a page.
§

type Saved = (K, V)

source§

fn save_deleted_leaf_entry(k: &K, v: &V) -> Self::Saved

Save a leaf entry as a replacement, when we delete at an internal node. This can be a pointer to the leaf if the leaf isn’t mutated, or the actual value, or something else.
source§

unsafe fn from_saved<'a>(s: &Self::Saved) -> (&'a K, &'a V)

Recover the saved value.
source§

unsafe fn put<'a, T: AllocPage>( txn: &mut T, page: CowPage, mutable: bool, replace: bool, c: &PageCursor, k0: &'a K, v0: &'a V, k1v1: Option<(&'a K, &'a V)>, l: u64, r: u64 ) -> Result<Put<'a, K, V>, T::Error>

Add an entry to the page, possibly splitting the page in the process. Read more
source§

unsafe fn put_mut<T: AllocPage>( txn: &mut T, page: &mut MutPage, c: &mut Self::Cursor, k0: &K, v0: &V, r: u64 )

Add an entry to page, at position c. Does not check whether there is enough space to do so. This method is mostly useful for cloning pages.
source§

unsafe fn set_left_child(page: &mut MutPage, c: &Self::Cursor, l: u64)

source§

unsafe fn update_left_child<T: AllocPage>( txn: &mut T, page: CowPage, mutable: bool, c: &Self::Cursor, l: u64 ) -> Result<Ok, T::Error>

Update the left child of the position pointed to by the cursor.
source§

unsafe fn del<T: AllocPage>( txn: &mut T, page: CowPage, mutable: bool, c: &PageCursor, l: u64 ) -> Result<(MutPage, u64), T::Error>

Delete an entry on the page, returning the resuting page along with the offset of the freed page (or 0 if no page was freed, i.e. if page is mutable).
source§

unsafe fn merge_or_rebalance<'a, T: AllocPage>( txn: &mut T, m: Concat<'a, K, V, Self> ) -> Result<Op<'a, T, K, V>, T::Error>

Merge, rebalance or update a concatenation.
source§

impl<K: Storable, V: Storable> BTreePage<K, V> for Page<K, V>

§

type Cursor = PageCursor

source§

fn is_empty(c: &Self::Cursor) -> bool

Whether this cursor is at the end of the page.
source§

fn is_init(c: &Self::Cursor) -> bool

Whether this cursor is strictly before the first element.
source§

fn cursor_before(p: &CowPage) -> Self::Cursor

Returns a cursor set before the first element of the page (i.e. set to -1).
source§

fn cursor_after(p: &CowPage) -> Self::Cursor

Returns a cursor set after the last element of the page (i.e. to element n)
source§

fn split_at(c: &Self::Cursor) -> (Self::Cursor, Self::Cursor)

Splits the cursor into two cursors: the elements strictly before the current position, and the elements greater than or equal the current element.
source§

fn move_next(c: &mut Self::Cursor) -> bool

Move the cursor to the next position. Returns whether the cursor was actually moved (i.e. true if and only if the cursor isn’t already after the last element).
source§

fn move_prev(c: &mut Self::Cursor) -> bool

Move the cursor to the previous position. Returns whether the cursor was actually moved (i.e. true if and only if the cursor isn’t strictly before the page).
source§

fn current<'a, T: LoadPage>( _txn: &T, page: Page<'a>, c: &Self::Cursor ) -> Option<(&'a K, &'a V, u64)>

Returns the current element, if the cursor is pointing at one.
source§

fn left_child(page: Page<'_>, c: &Self::Cursor) -> u64

Returns the left child of the entry pointed to by the cursor.
source§

fn right_child(page: Page<'_>, c: &Self::Cursor) -> u64

Returns the right child of the entry pointed to by the cursor.
source§

fn set_cursor<'a, T: LoadPage>( txn: &'a T, page: Page<'_>, c: &mut PageCursor, k0: &K, v0: Option<&V> ) -> Result<(&'a K, &'a V, u64), usize>

Sets the cursor to the last element less than or equal to k0 if v0.is_none(), and to (k0, v0) if v0.is_some(). If a match is found (on k0 only if v0.is_none(), on (k0, v0) else), return the match along with the right child. Read more
source§

fn cursor_first(p: &CowPage) -> Self::Cursor

Returns a cursor set to the first element of the page (i.e. 0). If the page is empty, the returned cursor might be empty.
source§

fn cursor_last(p: &CowPage) -> Self::Cursor

Returns a cursor set to the last element of the page. If the cursor is empty, this is the same as cursor_before.
source§

fn next<'b, T: LoadPage>( txn: &T, p: Page<'b>, c: &mut Self::Cursor ) -> Option<(&'b K, &'b V, u64)>

Return the element currently pointed to by the cursor (if the cursor is not before or after the elements of the page), and move the cursor to the next element.
source§

fn prev<'b, T: LoadPage>( txn: &T, p: Page<'b>, c: &mut Self::Cursor ) -> Option<(&'b K, &'b V, u64)>

Move the cursor to the previous element, and return that element. Note that this is not the symmetric of next.
source§

impl<K: Debug, V: Debug> Debug for Page<K, V>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K, V> RefUnwindSafe for Page<K, V>

§

impl<K, V> Send for Page<K, V>
where K: Send, V: Send,

§

impl<K, V> Sync for Page<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for Page<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for Page<K, V>
where K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.