pub struct RecordHeader {
pub magic: u32,
pub format_version: u16,
pub record_type: u32,
pub lsn: u64,
pub tenant_id: u64,
pub vshard_id: u32,
pub payload_len: u32,
pub database_id: u64,
pub reserved: [u8; 8],
pub crc32c: u32,
}Expand description
WAL record header (fixed 54 bytes).
Fields§
§magic: u32§format_version: u16§record_type: u32§lsn: u64§tenant_id: u64§vshard_id: u32§payload_len: u32§database_id: u64Database scope for this record. Stored as a raw u64; callers convert
to/from DatabaseId. Pre-Tier-2 records had zeros here, so 0 maps to
DatabaseId(0) (the default database) — fully backward compatible.
Occupies bytes 34–41 of the on-disk header (previously part of reserved).
reserved: [u8; 8]Reserved for future use; must be zero on write; ignored on read (but covered by CRC32C). Occupies bytes 42–49.
crc32c: u32Implementations§
Source§impl RecordHeader
impl RecordHeader
pub fn to_bytes(&self) -> [u8; 54]
pub fn from_bytes(buf: &[u8; 54]) -> Self
Sourcepub fn compute_checksum(&self, payload: &[u8]) -> u32
pub fn compute_checksum(&self, payload: &[u8]) -> u32
CRC32C over header (excluding the crc32c field) + payload.
The 16 reserved bytes are included in the CRC so they cannot be silently modified without detection.
Sourcepub fn logical_record_type(&self) -> u32
pub fn logical_record_type(&self) -> u32
Logical record type with the encryption flag stripped.
pub fn validate(&self, offset: u64) -> Result<()>
Trait Implementations§
Source§impl Clone for RecordHeader
impl Clone for RecordHeader
Source§fn clone(&self) -> RecordHeader
fn clone(&self) -> RecordHeader
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 RecordHeader
impl Debug for RecordHeader
Source§impl PartialEq for RecordHeader
impl PartialEq for RecordHeader
Source§fn eq(&self, other: &RecordHeader) -> bool
fn eq(&self, other: &RecordHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for RecordHeader
impl Eq for RecordHeader
impl StructuralPartialEq for RecordHeader
Auto Trait Implementations§
impl Freeze for RecordHeader
impl RefUnwindSafe for RecordHeader
impl Send for RecordHeader
impl Sync for RecordHeader
impl Unpin for RecordHeader
impl UnsafeUnpin for RecordHeader
impl UnwindSafe for RecordHeader
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