Skip to main content

PosixSlotAllocator

Struct PosixSlotAllocator 

Source
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

Source

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.

Source

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.

Pfad der flink-Datei (fuer Discovery).

Source

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

Source§

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 more
Source§

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 more
Source§

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>

Liest Slot-Header + Daten-Bytes (kopiert). Read more
Source§

fn mark_read( &self, handle: SlotHandle, reader_index: u8, ) -> Result<(), SlotError>

Setzt das Bit reader_index im reader_mask des Slots (Reader hat gelesen). Read more
Source§

fn mark_reader_disconnected(&self, reader_index: u8) -> Result<(), SlotError>

Setzt das reader_index-Bit retroaktiv auf allen Slots (SPDP-Lease-Expiry). Read more
Source§

fn slot_count(&self) -> Result<usize, SlotError>

Anzahl konfigurierter Slots. Read more
Source§

fn slot_total_size(&self) -> usize

Gesamt-Slot-Groesse (Header + Daten + Padding); fuer Discovery.
Source§

fn slot_capacity(&self) -> usize

Daten-Bereich pro Slot (ohne Header, ohne Padding).
Source§

fn type_hash(&self) -> Option<[u8; 16]>

Spec §6.1: TYPE_HASH des Topic-Type, falls dem Backend bekannt. None = Backend trackt keinen Hash; Caller muss auf andere Weise (z.B. Discovery) verifizieren. Default: None.
Source§

impl Send for PosixSlotAllocator

Source§

impl Sync for PosixSlotAllocator

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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V