pub struct UndoSegmentHeader {
pub state: UndoState,
pub last_log: u16,
}Expand description
Parsed undo segment header (only on first page of undo segment).
Fields§
§state: UndoStateState of the undo segment.
last_log: u16Offset of the last undo log header on the segment.
Implementations§
Source§impl UndoSegmentHeader
impl UndoSegmentHeader
Sourcepub fn parse(page_data: &[u8]) -> Option<Self>
pub fn parse(page_data: &[u8]) -> Option<Self>
Parse an undo segment header from a full page buffer.
The segment header follows the page header at FIL_PAGE_DATA + TRX_UNDO_PAGE_HDR_SIZE.
§Examples
use idb::innodb::undo::{UndoSegmentHeader, UndoState};
use byteorder::{BigEndian, ByteOrder};
// Need at least 38 (FIL header) + 18 (page header) + 30 (seg header) = 86 bytes.
let mut page = vec![0u8; 96];
let base = 38 + 18; // FIL_PAGE_DATA + TRX_UNDO_PAGE_HDR_SIZE
// State = CACHED (2) at base+0
BigEndian::write_u16(&mut page[base..], 2);
// Last log offset at base+2
BigEndian::write_u16(&mut page[base + 2..], 200);
let hdr = UndoSegmentHeader::parse(&page).unwrap();
assert_eq!(hdr.state, UndoState::Cached);
assert_eq!(hdr.last_log, 200);Trait Implementations§
Source§impl Clone for UndoSegmentHeader
impl Clone for UndoSegmentHeader
Source§fn clone(&self) -> UndoSegmentHeader
fn clone(&self) -> UndoSegmentHeader
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 UndoSegmentHeader
impl Debug for UndoSegmentHeader
Auto Trait Implementations§
impl Freeze for UndoSegmentHeader
impl RefUnwindSafe for UndoSegmentHeader
impl Send for UndoSegmentHeader
impl Sync for UndoSegmentHeader
impl Unpin for UndoSegmentHeader
impl UnsafeUnpin for UndoSegmentHeader
impl UnwindSafe for UndoSegmentHeader
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