pub struct HostcallReactorMesh { /* private fields */ }Expand description
Deterministic SPSC reactor mesh for hostcall traffic.
Routes fast-lane hostcall requests to per-shard SPSC lanes using stable hash routing (by call_id for affinity) or opcode-class routing.
Routing policy:
- Session opcodes: hash-routed by
call_id(shard affinity preserves per-call ordering for streaming scenarios). - Events opcodes: round-robin across shards for load distribution.
- Tool opcodes: hash-routed by
call_id.
Drain policy:
drain_shard(shard_id, budget)for per-shard processing.drain_global_order(budget)for deterministic cross-shard ordering.
Implementations§
Source§impl HostcallReactorMesh
impl HostcallReactorMesh
Sourcepub fn new(config: HostcallReactorConfig) -> Self
pub fn new(config: HostcallReactorConfig) -> Self
Create a new reactor mesh with the given configuration.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Number of shard lanes.
Sourcepub fn total_depth(&self) -> usize
pub fn total_depth(&self) -> usize
Total pending requests across all shards.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Whether any lane has pending requests.
Sourcepub fn telemetry(&self) -> HostcallReactorTelemetry
pub fn telemetry(&self) -> HostcallReactorTelemetry
Snapshot queueing telemetry.
Sourcepub fn core_id_for_shard(&self, shard_id: usize) -> Option<usize>
pub fn core_id_for_shard(&self, shard_id: usize) -> Option<usize>
Core affinity configuration (if any).
Sourcepub const fn numa_pool(&self) -> Option<&NumaSlabPool>
pub const fn numa_pool(&self) -> Option<&NumaSlabPool>
NUMA-aware slab pool (if core-ids were configured).
Sourcepub fn affinity_advice(&self) -> &[ThreadAffinityAdvice]
pub fn affinity_advice(&self) -> &[ThreadAffinityAdvice]
Thread affinity advice derived from reactor core mapping.
Sourcepub fn drain_shard(
&mut self,
shard_id: usize,
budget: usize,
) -> Vec<HostcallReactorRequest>
pub fn drain_shard( &mut self, shard_id: usize, budget: usize, ) -> Vec<HostcallReactorRequest>
Drain up to budget requests from a specific shard.
Sourcepub fn drain_global_order(
&mut self,
budget: usize,
) -> Vec<HostcallReactorRequest>
pub fn drain_global_order( &mut self, budget: usize, ) -> Vec<HostcallReactorRequest>
Drain across all shards in deterministic global sequence order.
Sourcepub const fn record_completions(&mut self, count: u64)
pub const fn record_completions(&mut self, count: u64)
Record that a batch of completions was produced by shard processing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HostcallReactorMesh
impl RefUnwindSafe for HostcallReactorMesh
impl Send for HostcallReactorMesh
impl Sync for HostcallReactorMesh
impl Unpin for HostcallReactorMesh
impl UnsafeUnpin for HostcallReactorMesh
impl UnwindSafe for HostcallReactorMesh
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more