pub struct RecordHeader {
pub magic: u32,
pub format_version: u16,
pub record_type: u16,
pub lsn: u64,
pub tenant_id: u32,
pub vshard_id: u16,
pub payload_len: u32,
pub crc32c: u32,
}Expand description
WAL record header (fixed 30 bytes).
Fields§
§magic: u32Magic number (WAL_MAGIC).
format_version: u16Format version for forward/backward compatibility.
record_type: u16Record type discriminant.
lsn: u64Log Sequence Number — monotonically increasing, globally unique.
tenant_id: u32Tenant ID for multi-tenant isolation.
vshard_id: u16Virtual shard ID for routing.
payload_len: u32Length of the payload following this header.
crc32c: u32CRC32C of the header (excluding this field) + payload.
Implementations§
Source§impl RecordHeader
impl RecordHeader
Sourcepub fn from_bytes(buf: &[u8; 30]) -> Self
pub fn from_bytes(buf: &[u8; 30]) -> Self
Deserialize a header from a byte buffer.
Sourcepub fn compute_checksum(&self, payload: &[u8]) -> u32
pub fn compute_checksum(&self, payload: &[u8]) -> u32
Compute the CRC32C over the header (excluding the crc32c field) + payload.
Sourcepub fn logical_record_type(&self) -> u16
pub fn logical_record_type(&self) -> u16
Get the logical record type (with encryption flag stripped).
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 · 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
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