Skip to main content

SharedDequeFcl

Struct SharedDequeFcl 

Source
pub struct SharedDequeFcl { /* private fields */ }
Expand description

MMF-backed Fat Chase-Lev deque. Counter-only Chase-Lev protocol with K_inner = 3 items per slot, single owner, N thieves.

Wraps SharedDeque<FatLineItem> with a caller-facing publish_batch API that packs LineItem payloads into 64-byte fat slots.

Implementations§

Source§

impl SharedDequeFcl

Source

pub fn create<P: AsRef<Path>>(path: P, capacity_slots: usize) -> Result<Self>

Create a fresh Fcl file. capacity_slots rounds up to the next power of two. Total item capacity is capacity_slots * LINE_ITEMS.

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Open an existing Fcl file as a thief (read-side).

Source

pub fn capacity_slots(&self) -> usize

Capacity in slots (power of two). Total item capacity is capacity_slots() * LINE_ITEMS.

Source

pub fn approx_len_slots(&self) -> usize

Snapshot the current ring fill in slots.

Source

pub fn publish_batch(&self, items: &[LineItem]) -> Result<usize, DequeError>

Owner-side batched publish. Packs items into ceil(items.len() / LINE_ITEMS) fat slots, then publishes them with ONE top load + ONE Release fence + ONE Relaxed bottom store via SharedDeque::push_batch.

Cost: 1 top load + ceil(K/3) cache-line writes + 1 Release fence + 1 bottom store. No per-slot atomic.

Returns the number of items published. Returns Err(DequeError::Full) if the batch would overflow the ring.

Source

pub fn steal_slot(&self) -> Option<FatLineItem>

Thief-side steal. Returns one fat slot (1..=LINE_ITEMS items) or None if the ring is empty / CAS lost.

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.