pub struct ReactorMesh { /* private fields */ }Expand description
Deterministic multi-shard reactor mesh using bounded per-shard SPSC lanes.
Routing policy:
- Hostcall completions are hash-routed by
call_idfor shard affinity. - Inbound events use deterministic round-robin distribution across shards.
Drain policy:
drain_global_order()emits envelopes in ascending global sequence across all shard heads, preserving deterministic external ordering.
Implementations§
Source§impl ReactorMesh
impl ReactorMesh
Sourcepub fn new(config: ReactorMeshConfig) -> Self
pub fn new(config: ReactorMeshConfig) -> Self
Create a mesh using the provided config.
The mesh is fail-closed for invalid config values:
shard_count == 0 or lane_capacity == 0 returns an empty mesh.
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 envelopes across all shards.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Whether any lane has pending envelopes.
Sourcepub fn queue_depth(&self, shard_id: usize) -> Option<usize>
pub fn queue_depth(&self, shard_id: usize) -> Option<usize>
Per-shard queue depth.
Sourcepub fn telemetry(&self) -> ReactorMeshTelemetry
pub fn telemetry(&self) -> ReactorMeshTelemetry
Snapshot queueing telemetry for diagnostics.
Sourcepub const fn placement_manifest(&self) -> &ReactorPlacementManifest
pub const fn placement_manifest(&self) -> &ReactorPlacementManifest
Deterministic shard placement manifest used by this mesh.
Sourcepub fn enqueue_hostcall_complete(
&mut self,
call_id: String,
outcome: HostcallOutcome,
) -> Result<ReactorEnvelope, ReactorBackpressure>
pub fn enqueue_hostcall_complete( &mut self, call_id: String, outcome: HostcallOutcome, ) -> Result<ReactorEnvelope, ReactorBackpressure>
Enqueue a hostcall completion using deterministic hash routing.
Sourcepub fn enqueue_event(
&mut self,
event_id: String,
payload: Value,
) -> Result<ReactorEnvelope, ReactorBackpressure>
pub fn enqueue_event( &mut self, event_id: String, payload: Value, ) -> Result<ReactorEnvelope, ReactorBackpressure>
Enqueue an inbound event using deterministic round-robin routing.
Sourcepub fn drain_shard(
&mut self,
shard_id: usize,
budget: usize,
) -> Vec<ReactorEnvelope>
pub fn drain_shard( &mut self, shard_id: usize, budget: usize, ) -> Vec<ReactorEnvelope>
Drain one shard up to budget envelopes.
Sourcepub fn drain_global_order(&mut self, budget: usize) -> Vec<ReactorEnvelope>
pub fn drain_global_order(&mut self, budget: usize) -> Vec<ReactorEnvelope>
Drain across shards in deterministic global sequence order.
Source§impl ReactorMesh
impl ReactorMesh
Sourcepub fn preferred_numa_node(&self, shard_id: usize) -> usize
pub fn preferred_numa_node(&self, shard_id: usize) -> usize
Look up the preferred NUMA node for a shard via the placement manifest.
Sourcepub fn affinity_advice(
&self,
enforcement: AffinityEnforcement,
) -> Vec<ThreadAffinityAdvice>
pub fn affinity_advice( &self, enforcement: AffinityEnforcement, ) -> Vec<ThreadAffinityAdvice>
Generate thread affinity advice from the mesh’s placement manifest.
Trait Implementations§
Source§impl Clone for ReactorMesh
impl Clone for ReactorMesh
Source§fn clone(&self) -> ReactorMesh
fn clone(&self) -> ReactorMesh
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReactorMesh
impl RefUnwindSafe for ReactorMesh
impl Send for ReactorMesh
impl Sync for ReactorMesh
impl Unpin for ReactorMesh
impl UnsafeUnpin for ReactorMesh
impl UnwindSafe for ReactorMesh
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
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>
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>
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