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>
impl<K: Storable + Debug, V: Storable + Debug> BTreeMutPage<K, V> for Page<K, V>
type Saved = (K, V)
source§fn save_deleted_leaf_entry(k: &K, v: &V) -> Self::Saved
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 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>
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
)
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.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>
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§impl<K: Storable, V: Storable> BTreePage<K, V> for Page<K, V>
impl<K: Storable, V: Storable> BTreePage<K, V> for Page<K, V>
type Cursor = PageCursor
source§fn is_init(c: &Self::Cursor) -> bool
fn is_init(c: &Self::Cursor) -> bool
Whether this cursor is strictly before the first element.
source§fn cursor_before(p: &CowPage) -> Self::Cursor
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
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)
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
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
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)>
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
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
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>
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 moresource§fn cursor_first(p: &CowPage) -> Self::Cursor
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
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
.Auto Trait Implementations§
impl<K, V> RefUnwindSafe for Page<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Page<K, V>
impl<K, V> Sync for Page<K, V>
impl<K, V> Unpin for Page<K, V>
impl<K, V> UnwindSafe for Page<K, V>where
K: UnwindSafe,
V: 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