pub struct DatabaseHeader {
pub magic: [u8; 4],
pub version: u32,
pub schema_root_page: u32,
pub next_table_id: u32,
pub checksum: u32,
}Expand description
Database header structure stored on page 0.
Fields§
§magic: [u8; 4]Magic bytes to identify Hematite database files
version: u32Database format version
schema_root_page: u32Root page of the schema B-tree
next_table_id: u32Next available table ID
checksum: u32Header checksum for integrity verification
Implementations§
Source§impl DatabaseHeader
impl DatabaseHeader
Sourcepub const CURRENT_VERSION: u32 = 2
pub const CURRENT_VERSION: u32 = 2
Current database format version.
Version 2 is the first version after the M0 storage reset that intentionally breaks compatibility with previous files.
Sourcepub const HEADER_PAGE_ID: u32 = 0
pub const HEADER_PAGE_ID: u32 = 0
Fixed page ID for database header (consistent with existing implementation)
Sourcepub fn calculate_checksum(&self) -> u32
pub fn calculate_checksum(&self) -> u32
Calculate checksum for header integrity
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify header integrity
Sourcepub fn deserialize(bytes: &[u8]) -> Result<Self>
pub fn deserialize(bytes: &[u8]) -> Result<Self>
Deserialize header from page data
Sourcepub fn increment_table_id(&mut self) -> TableId
pub fn increment_table_id(&mut self) -> TableId
Update next table ID and recalculate checksum
Trait Implementations§
Source§impl Clone for DatabaseHeader
impl Clone for DatabaseHeader
Source§fn clone(&self) -> DatabaseHeader
fn clone(&self) -> DatabaseHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DatabaseHeader
impl RefUnwindSafe for DatabaseHeader
impl Send for DatabaseHeader
impl Sync for DatabaseHeader
impl Unpin for DatabaseHeader
impl UnsafeUnpin for DatabaseHeader
impl UnwindSafe for DatabaseHeader
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