pub struct PageHeader {
pub page_type: PageType,
pub flags: u8,
pub cell_count: u16,
pub free_start: u16,
pub free_end: u16,
pub page_id: u32,
pub parent_id: u32,
pub right_child: u32,
pub lsn: u64,
pub checksum: u32,
}Expand description
Page header structure (32 bytes)
Layout:
Offset Size Field
------ ---- -----
0 1 page_type
1 1 flags
2 2 cell_count
4 2 free_start (offset to first free byte in cell pointer array)
6 2 free_end (offset to first free byte before cell content)
8 4 page_id
12 4 parent_id (0 for root)
16 4 right_child (for interior nodes, 0 otherwise)
20 8 lsn (Log Sequence Number for WAL)
28 4 checksum (CRC32 of content)Fields§
§page_type: PageTypeType of this page
flags: u8Page flags (dirty, locked, etc.)
cell_count: u16Number of cells on this page
free_start: u16Offset to start of free space (cell pointer array end)
free_end: u16Offset to end of free space (cell content start)
page_id: u32Unique page identifier
parent_id: u32Parent page ID (0 for root or orphan)
right_child: u32Right-most child page (interior nodes only)
lsn: u64Log Sequence Number (for WAL ordering)
checksum: u32CRC32 checksum of page content
Implementations§
Source§impl PageHeader
impl PageHeader
Sourcepub fn new(page_type: PageType, page_id: u32) -> PageHeader
pub fn new(page_type: PageType, page_id: u32) -> PageHeader
Create a new header for an empty page
Sourcepub fn from_bytes(buf: &[u8; 32]) -> Result<PageHeader, PageError>
pub fn from_bytes(buf: &[u8; 32]) -> Result<PageHeader, PageError>
Deserialize header from bytes
Sourcepub fn clear_flag(&mut self, flag: PageFlag)
pub fn clear_flag(&mut self, flag: PageFlag)
Clear a flag
Sourcepub fn free_space(&self) -> usize
pub fn free_space(&self) -> usize
Calculate free space available for new cells
Trait Implementations§
Source§impl Clone for PageHeader
impl Clone for PageHeader
Source§fn clone(&self) -> PageHeader
fn clone(&self) -> PageHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PageHeader
impl Debug for PageHeader
impl Copy for PageHeader
Auto Trait Implementations§
impl Freeze for PageHeader
impl RefUnwindSafe for PageHeader
impl Send for PageHeader
impl Sync for PageHeader
impl Unpin for PageHeader
impl UnsafeUnpin for PageHeader
impl UnwindSafe for PageHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request