Skip to main content

SegmentHeader

Struct SegmentHeader 

Source
#[repr(C)]
pub struct SegmentHeader {
Show 14 fields pub magic: u32, pub version: u8, pub seg_type: u8, pub flags: u16, pub segment_id: u64, pub payload_length: u64, pub timestamp_ns: u64, pub checksum_algo: u8, pub compression: u8, pub reserved_0: u16, pub reserved_1: u32, pub content_hash: [u8; 16], pub uncompressed_len: u32, pub alignment_pad: u32,
}
Expand description

The fixed 64-byte header that precedes every segment payload.

Layout matches the wire format exactly (repr(C), little-endian fields). Aligned to 64 bytes to match SIMD register width and cache-line size.

Fields§

§magic: u32

Magic number: must be 0x52564653 (“RVFS”).

§version: u8

Segment format version (currently 1).

§seg_type: u8

Segment type discriminator (see SegmentType).

§flags: u16

Bitfield flags (see SegmentFlags).

§segment_id: u64

Monotonically increasing segment ordinal.

§payload_length: u64

Byte length of payload (after header, before optional footer).

§timestamp_ns: u64

Nanosecond UNIX timestamp of segment creation.

§checksum_algo: u8

Hash algorithm enum: 0=CRC32C, 1=XXH3-128, 2=SHAKE-256.

§compression: u8

Compression enum: 0=none, 1=LZ4, 2=ZSTD, 3=custom.

§reserved_0: u16

Reserved (must be zero).

§reserved_1: u32

Reserved (must be zero).

§content_hash: [u8; 16]

First 128 bits of payload hash (algorithm per checksum_algo).

§uncompressed_len: u32

Original payload size before compression (0 if uncompressed).

§alignment_pad: u32

Padding to reach the 64-byte boundary.

Implementations§

Source§

impl SegmentHeader

Source

pub const fn new(seg_type: u8, segment_id: u64) -> Self

Create a new segment header with the given type and segment ID. All other fields are set to defaults.

Source

pub const fn is_valid_magic(&self) -> bool

Check whether the magic field matches the expected value.

Trait Implementations§

Source§

impl Clone for SegmentHeader

Source§

fn clone(&self) -> SegmentHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SegmentHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SegmentHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.