pub struct PosixSlotAllocator { /* private fields */ }Expand description
POSIX-mmap Slot-Allocator. Ein Owner-Process erzeugt das Segment;
Consumer-Processes attachen via attach.
Implementations§
Source§impl PosixSlotAllocator
impl PosixSlotAllocator
Sourcepub fn create<P: Into<PathBuf>>(
flink_path: P,
slot_count: usize,
slot_capacity: usize,
) -> Result<Self, PosixSlotError>
pub fn create<P: Into<PathBuf>>( flink_path: P, slot_count: usize, slot_capacity: usize, ) -> Result<Self, PosixSlotError>
Erzeugt ein neues POSIX-SHM-Segment als Owner.
flink_path ist eine Datei im Filesystem (typisch
/tmp/zerodds/<segment_id>.flink), die dem Consumer den
realen OS-Segment-Namen verraet.
§Errors
Shm bei shm_open-Fehler; CapacityOverflow wenn
slot_capacity > u32::MAX.
Sourcepub fn attach<P: Into<PathBuf>>(flink_path: P) -> Result<Self, PosixSlotError>
pub fn attach<P: Into<PathBuf>>(flink_path: P) -> Result<Self, PosixSlotError>
Attached an ein bestehendes POSIX-SHM-Segment via flink-Pfad.
Der Caller wird Consumer (kein Owner — Drop unmappt nur, nicht
shm_unlink).
§Errors
Shm bei attach-Fehler; InvalidHeader wenn Magic/Layout
nicht stimmt.
Sourcepub fn flink_path(&self) -> &str
pub fn flink_path(&self) -> &str
Pfad der flink-Datei (fuer Discovery).
Sourcepub fn segment_path(&self) -> String
pub fn segment_path(&self) -> String
Liefert den Segment-Pfad als String fuer den ShmLocator. Dies ist das, was im PID_SHM_LOCATOR steht.
Trait Implementations§
Source§impl SlotBackend for PosixSlotAllocator
impl SlotBackend for PosixSlotAllocator
Source§fn reserve_slot(
&self,
active_readers_mask: ReaderMask,
) -> Result<SlotHandle, SlotError>
fn reserve_slot( &self, active_readers_mask: ReaderMask, ) -> Result<SlotHandle, SlotError>
Reserviert einen freien Slot. Caller schreibt danach via
commit_slot und veroeffentlicht damit das Sample. Read moreSource§fn commit_slot(
&self,
handle: SlotHandle,
bytes: &[u8],
) -> Result<u32, SlotError>
fn commit_slot( &self, handle: SlotHandle, bytes: &[u8], ) -> Result<u32, SlotError>
Schreibt sample-bytes in den Slot und setzt SlotHeader
{ sn, sample_size, reader_mask=0 }. Liefert die SN. Read moreSource§fn discard_slot(&self, handle: SlotHandle) -> Result<(), SlotError>
fn discard_slot(&self, handle: SlotHandle) -> Result<(), SlotError>
Verwirft einen Loan ohne Commit. Slot wird wieder frei. Read more
Source§fn read_slot(
&self,
handle: SlotHandle,
) -> Result<(SlotHeader, Vec<u8>), SlotError>
fn read_slot( &self, handle: SlotHandle, ) -> Result<(SlotHeader, Vec<u8>), SlotError>
Liest Slot-Header + Daten-Bytes (kopiert). Read more
Source§fn mark_reader_disconnected(&self, reader_index: u8) -> Result<(), SlotError>
fn mark_reader_disconnected(&self, reader_index: u8) -> Result<(), SlotError>
Setzt das
reader_index-Bit retroaktiv auf allen Slots
(SPDP-Lease-Expiry). Read moreSource§fn slot_total_size(&self) -> usize
fn slot_total_size(&self) -> usize
Gesamt-Slot-Groesse (Header + Daten + Padding); fuer Discovery.
Source§fn slot_capacity(&self) -> usize
fn slot_capacity(&self) -> usize
Daten-Bereich pro Slot (ohne Header, ohne Padding).
impl Send for PosixSlotAllocator
impl Sync for PosixSlotAllocator
Auto Trait Implementations§
impl !Freeze for PosixSlotAllocator
impl RefUnwindSafe for PosixSlotAllocator
impl Unpin for PosixSlotAllocator
impl UnsafeUnpin for PosixSlotAllocator
impl UnwindSafe for PosixSlotAllocator
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