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
impl DequeDispatcher
Sourcepub fn builder() -> DispatcherBuilder
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.
Sourcepub fn chase_lev(&self) -> Option<&Arc<SharedDeque<LineItem>>>
pub fn chase_lev(&self) -> Option<&Arc<SharedDeque<LineItem>>>
Get the underlying Chase-Lev handle (if configured).
Sourcepub fn khpd(&self) -> Option<&Arc<SharedDequeKhpd>>
pub fn khpd(&self) -> Option<&Arc<SharedDequeKhpd>>
Get the underlying KHPD handle (if configured).
Sourcepub fn loh(&self) -> Option<&Arc<SharedDequeLoh>>
pub fn loh(&self) -> Option<&Arc<SharedDequeLoh>>
Get the underlying LOH handle (if configured).
Sourcepub fn urd(&self) -> Option<&Arc<SharedDequeUrd>>
pub fn urd(&self) -> Option<&Arc<SharedDequeUrd>>
Get the underlying URD handle (if configured).
Sourcepub fn khl(&self) -> Option<&Arc<SharedDequeKhl>>
pub fn khl(&self) -> Option<&Arc<SharedDequeKhl>>
Get the underlying KHL handle (if configured).
Sourcepub fn pick(shape: WorkloadShape) -> DequeVariant
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).
Sourcepub fn pick_by_signature(shape: WorkloadShape) -> DequeVariant
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.
Sourcepub fn pick_with_fallback(&self, shape: WorkloadShape) -> Option<DequeVariant>
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.
Sourcepub fn is_configured(&self, variant: DequeVariant) -> bool
pub fn is_configured(&self, variant: DequeVariant) -> bool
Check whether variant is configured on this dispatcher.
Sourcepub fn dispatch_one(
&self,
shape: WorkloadShape,
item: LineItem,
) -> Result<DequeVariant, DispatchError>
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.
Sourcepub fn dispatch_batch(
&self,
shape: WorkloadShape,
items: &[LineItem],
) -> Result<DequeVariant, DispatchError>
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.