pub struct SegmentHeader {Show 14 fields
pub magic: [u8; 8],
pub version: u32,
pub header_size: u32,
pub total_size: u64,
pub max_payload_size: u32,
pub inline_threshold: u32,
pub max_guests: u32,
pub bipbuf_capacity: u32,
pub peer_table_offset: u64,
pub var_pool_offset: u64,
pub heartbeat_interval: u64,
pub host_goodbye: AtomicU32,
pub num_var_slot_classes: u32,
pub current_size: AtomicU64,
/* private fields */
}Expand description
The segment header lives at offset 0 of every roam SHM segment.
All fields are set by the host at creation time and treated as read-only
by guests after attach — except host_goodbye and current_size, which
the host may update at runtime.
r[impl shm.segment] r[impl shm.segment.header] r[impl shm.segment.config]
Fields§
§magic: [u8; 8]“ROAMHUB\x07” — identifies a v7 roam SHM segment.
version: u32Segment format version (currently 7).
header_size: u32Always 128 — allows future extension without breaking older readers.
total_size: u64Total size of the segment in bytes (set at creation).
max_payload_size: u32Maximum payload size in bytes.
inline_threshold: u32Inline threshold: payloads ≤ this go inline; larger ones use a slot ref. 0 means use the default (256 bytes).
max_guests: u32Maximum number of guests (≤ 255).
bipbuf_capacity: u32BipBuffer data region size per direction, in bytes.
peer_table_offset: u64Byte offset of the peer table from the start of the segment.
var_pool_offset: u64Byte offset of the shared VarSlotPool from the start of the segment.
heartbeat_interval: u64Heartbeat interval in nanoseconds; 0 = heartbeats disabled.
host_goodbye: AtomicU32Set to non-zero by the host during orderly shutdown.
num_var_slot_classes: u32Number of var-slot size classes described at var_pool_offset.
current_size: AtomicU64Current segment size in bytes. May grow if extents are appended.
Implementations§
Source§impl SegmentHeader
impl SegmentHeader
Sourcepub unsafe fn init(&mut self, init: SegmentHeaderInit)
pub unsafe fn init(&mut self, init: SegmentHeaderInit)
Write initial values into a zeroed header.
§Safety
self must point into exclusively-owned, zeroed memory.
Sourcepub fn validate(&self) -> Result<(), &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Validate that the header looks like a v7 roam segment.
Returns Err with a description if validation fails.
r[impl shm.segment.magic.v7]
Sourcepub fn effective_inline_threshold(&self) -> u32
pub fn effective_inline_threshold(&self) -> u32
Read the effective inline threshold (substituting the default if 0).
Sourcepub fn current_size(&self) -> u64
pub fn current_size(&self) -> u64
Read the current segment size.
Sourcepub fn host_goodbye(&self) -> bool
pub fn host_goodbye(&self) -> bool
Check whether the host has raised the goodbye flag.