pub struct UndoPageHeader {
pub page_type: UndoPageType,
pub start: u16,
pub free: u16,
}Expand description
Parsed undo log page header.
Fields§
§page_type: UndoPageTypeType of undo log (INSERT or UPDATE).
start: u16Offset of the start of undo log records on this page.
free: u16Offset of the first free byte on this page.
Implementations§
Source§impl UndoPageHeader
impl UndoPageHeader
Sourcepub fn parse(page_data: &[u8]) -> Option<Self>
pub fn parse(page_data: &[u8]) -> Option<Self>
Parse an undo page header from a full page buffer.
The undo page header starts at FIL_PAGE_DATA (byte 38).
§Examples
use idb::innodb::undo::{UndoPageHeader, UndoPageType};
use byteorder::{BigEndian, ByteOrder};
// Build a minimal page buffer (at least 38 + 18 = 56 bytes).
let mut page = vec![0u8; 64];
let base = 38; // FIL_PAGE_DATA
// Undo page type = UPDATE (2) at offset base+0
BigEndian::write_u16(&mut page[base..], 2);
// Start offset at base+2
BigEndian::write_u16(&mut page[base + 2..], 80);
// Free offset at base+4
BigEndian::write_u16(&mut page[base + 4..], 160);
let hdr = UndoPageHeader::parse(&page).unwrap();
assert_eq!(hdr.page_type, UndoPageType::Update);
assert_eq!(hdr.start, 80);
assert_eq!(hdr.free, 160);Trait Implementations§
Source§impl Clone for UndoPageHeader
impl Clone for UndoPageHeader
Source§fn clone(&self) -> UndoPageHeader
fn clone(&self) -> UndoPageHeader
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 UndoPageHeader
impl Debug for UndoPageHeader
Auto Trait Implementations§
impl Freeze for UndoPageHeader
impl RefUnwindSafe for UndoPageHeader
impl Send for UndoPageHeader
impl Sync for UndoPageHeader
impl Unpin for UndoPageHeader
impl UnsafeUnpin for UndoPageHeader
impl UnwindSafe for UndoPageHeader
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> 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