Skip to main content

SharedDequeKhl

Struct SharedDequeKhl 

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

MMF-backed K-axis Hierarchical LCRQ deque. Single owner, N thieves.

Implementations§

Source§

impl SharedDequeKhl

Source

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

Create a fresh KHL file. capacity rounds up to the next power of two (min 2). Capacity is in SLOTS; total item capacity is capacity * KHL_ITEMS_PER_SLOT.

Source

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

Open an existing KHL file.

Source

pub fn capacity(&self) -> usize

Capacity in slots (always a power of two). Total item capacity is capacity() * KHL_ITEMS_PER_SLOT.

Source

pub fn publish_radius(&self) -> PublishRadius

The currently configured K_radius axis value. Defaults to PublishRadius::pick_auto at construction; callers can override via Self::with_publish_radius when they know the producer-consumer coherence distance in advance (e.g. a cross-CCD scheduler explicitly requesting Distant).

Source

pub fn with_publish_radius(self, radius: PublishRadius) -> Self

Override the publish radius for this handle. The setter resolves Distant to Local on hosts without MOVDIR64B so callers can request Distant unconditionally without breaking on older silicon.

Source

pub fn owner_pid(&self) -> u64

Owner pid at create time, or 0 after close_owner().

Source

pub fn close_owner(&self)

Owner shutdown: zero pid + advance epoch.

Source

pub fn snapshot_size(&self) -> (i64, i64, i64)

Snapshot (head, tail, ring_size_slots). Loads are independent; the tuple is not a linearizable snapshot.

Source

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

Owner-side batch publish. Packs items into ceil(items.len() / KHL_ITEMS_PER_SLOT) slots, advances the owner-private tail by that many slots via ONE Release-store (no atomic fetch_add), and writes each slot’s payload with one Release-store on the per-slot Vyukov sequence number.

Only the owner process may call this.

Cost per call: 1 Release-store on tail + ceil(K/3) slot Release-stores. For K=64 items: 1 + 22 = 23 atomic ops total vs Chase-Lev’s 64+ and LOH’s 65.

Returns the number of items published.

Source

pub fn steal_slot(&self) -> Steal

Thief-side steal. Claim one slot’s worth of items via CAS on the shared head + Acquire-load on the per-slot sequence.

Source

pub fn flush_to_disk(&self) -> Result<()>

Force any dirty pages to disk.

Trait Implementations§

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.