Skip to main content

DequeDispatcher

Struct DequeDispatcher 

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

MMF-backed dispatcher across the deque family.

Construct via DequeDispatcher::builder and pass the backing paths for each variant the caller wants available. The pick helper returns the routing decision for a shape WITHOUT performing the push, useful for observers and per-host calibration.

Implementations§

Source§

impl DequeDispatcher

Source

pub fn builder() -> DispatcherBuilder

Start a builder. Pass the backing file paths for whichever variants the caller wants available; unset variants stay None and the dispatcher falls through to the next-best available variant per pick.

Source

pub fn chase_lev(&self) -> Option<&Arc<SharedDeque<LineItem>>>

Get the underlying Chase-Lev handle (if configured).

Source

pub fn khpd(&self) -> Option<&Arc<SharedDequeKhpd>>

Get the underlying KHPD handle (if configured).

Source

pub fn loh(&self) -> Option<&Arc<SharedDequeLoh>>

Get the underlying LOH handle (if configured).

Source

pub fn urd(&self) -> Option<&Arc<SharedDequeUrd>>

Get the underlying URD handle (if configured).

Source

pub fn khl(&self) -> Option<&Arc<SharedDequeKhl>>

Get the underlying KHL handle (if configured).

Source

pub fn pick(shape: WorkloadShape) -> DequeVariant

Pick the right variant for shape. Returns the variant independent of whether the corresponding handle is configured (use pick_with_fallback to fold the configuration check into the decision).

Source

pub fn pick_by_signature(shape: WorkloadShape) -> DequeVariant

Pick a variant by signature-set satisfaction. For each variant in priority order, check whether its signature is a superset of the workload’s required signature; return the first match. Agrees with pick on every canonical workload shape.

The dispatcher becomes a signature-set lens rather than a hardcoded match arm; the two routing methods co-exist so downstream callers can pick the pattern that fits their style.

Source

pub fn pick_with_fallback(&self, shape: WorkloadShape) -> Option<DequeVariant>

Pick the right variant for shape, falling through to the next-best available variant when the primary pick is not configured on this dispatcher.

Fallback chain (in order): primary -> KHPD -> LOH -> Chase-Lev -> URD. Returns None only when no variant is configured at all.

Source

pub fn is_configured(&self, variant: DequeVariant) -> bool

Check whether variant is configured on this dispatcher.

Source

pub fn dispatch_one( &self, shape: WorkloadShape, item: LineItem, ) -> Result<DequeVariant, DispatchError>

Dispatch a single item under shape. Routes to whichever variant the pick_with_fallback decision selects. Returns the chosen variant so observers can confirm the routing.

For per-item dispatch the natural target is Chase-Lev (one Release-store on bottom per push). KHPD / LOH / URD all accept a single-item batch and degrade to one slot write per call.

Source

pub fn dispatch_batch( &self, shape: WorkloadShape, items: &[LineItem], ) -> Result<DequeVariant, DispatchError>

Dispatch a batch of items under shape. Routes per pick_with_fallback. Returns the chosen variant.

For Chase-Lev (per-item primitive) the batch is pushed one item at a time. For KHPD / LOH the batch is published via the variant’s publish_batch hot path. For URD the batch is chunked by MAILBOX_ITEMS = 3 and round-robined across the configured mailboxes.

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.