pub struct SharedDequeKhl { /* private fields */ }Expand description
MMF-backed K-axis Hierarchical LCRQ deque. Single owner, N thieves.
Implementations§
Sourcepub fn create<P: AsRef<Path>>(path: P, capacity: usize) -> Result<Self>
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.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Capacity in slots (always a power of two). Total item
capacity is capacity() * KHL_ITEMS_PER_SLOT.
Sourcepub fn publish_radius(&self) -> PublishRadius
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).
Sourcepub fn with_publish_radius(self, radius: PublishRadius) -> Self
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.
Sourcepub fn close_owner(&self)
pub fn close_owner(&self)
Owner shutdown: zero pid + advance epoch.
Sourcepub fn snapshot_size(&self) -> (i64, i64, i64)
pub fn snapshot_size(&self) -> (i64, i64, i64)
Snapshot (head, tail, ring_size_slots). Loads are
independent; the tuple is not a linearizable snapshot.
Sourcepub fn publish_batch(&self, items: &[LineItem]) -> Result<usize, PushError>
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.
Sourcepub fn steal_slot(&self) -> Steal
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.
Sourcepub fn flush_to_disk(&self) -> Result<()>
pub fn flush_to_disk(&self) -> Result<()>
Force any dirty pages to disk.