pub struct Page {
pub header: PageHeader,
pub data: BytesMut,
}Expand description
Page - a fixed-size storage unit
Fields§
§header: PageHeaderPage header
data: BytesMutPage data (excluding header)
Implementations§
Source§impl Page
impl Page
Sourcepub fn from_bytes(bytes: &[u8]) -> KernelResult<Self>
pub fn from_bytes(bytes: &[u8]) -> KernelResult<Self>
Create from raw bytes
Sourcepub fn lsn(&self) -> LogSequenceNumber
pub fn lsn(&self) -> LogSequenceNumber
Get page LSN
Sourcepub fn set_lsn(&mut self, lsn: LogSequenceNumber)
pub fn set_lsn(&mut self, lsn: LogSequenceNumber)
Set page LSN (after modification)
Sourcepub fn needs_redo(&self, record_lsn: LogSequenceNumber) -> bool
pub fn needs_redo(&self, record_lsn: LogSequenceNumber) -> bool
Check if page needs redo during recovery
Returns true if the page’s LSN is less than the WAL record’s LSN, meaning the WAL record’s changes haven’t been applied yet.
Sourcepub fn compute_checksum(&self) -> u32
pub fn compute_checksum(&self) -> u32
Compute checksum for the page
Sourcepub fn validate_checksum(&self) -> bool
pub fn validate_checksum(&self) -> bool
Validate page checksum
Sourcepub fn update_checksum(&mut self)
pub fn update_checksum(&mut self)
Update checksum before writing to disk
Auto Trait Implementations§
impl Freeze for Page
impl RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl UnsafeUnpin for Page
impl UnwindSafe for Page
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> 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 more