pub struct TestScopedRuntime<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize>{ /* private fields */ }Expand description
Concurrent runtime that delegates to ScopedGraphApi::run_scoped.
Implements LimenRuntime. The runtime is the orchestrator:
step(): sequential round-robin viaGraphApi::step_node_by_index. For debug/test single-tick use.run(): overrides default. Creates aSimpleBackoffSchedulerand callsgraph.run_scoped(clock, telemetry, scheduler)— one scoped thread per node, true concurrent execution, scheduler-controlled stepping.
Implementations§
Source§impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>
Sourcepub fn with_telemetry<F, R>(&mut self, f: F) -> Result<Option<R>, RuntimeError>
pub fn with_telemetry<F, R>(&mut self, f: F) -> Result<Option<R>, RuntimeError>
Safely access telemetry by mutable reference, if present.
Trait Implementations§
Source§impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Default for TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>
impl<C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> Default for TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>
Source§impl<Graph, C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> LimenRuntime<Graph, NODE_COUNT, EDGE_COUNT> for TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>where
Graph: GraphApi<NODE_COUNT, EDGE_COUNT> + ScopedGraphApi<NODE_COUNT, EDGE_COUNT>,
C: PlatformClock + Clone + Send + Sync + 'static,
T: Telemetry + Clone + Send + 'static,
impl<Graph, C, T, const NODE_COUNT: usize, const EDGE_COUNT: usize> LimenRuntime<Graph, NODE_COUNT, EDGE_COUNT> for TestScopedRuntime<C, T, NODE_COUNT, EDGE_COUNT>where
Graph: GraphApi<NODE_COUNT, EDGE_COUNT> + ScopedGraphApi<NODE_COUNT, EDGE_COUNT>,
C: PlatformClock + Clone + Send + Sync + 'static,
T: Telemetry + Clone + Send + 'static,
Source§fn step(&mut self, graph: &mut Graph) -> Result<bool, Self::Error>
fn step(&mut self, graph: &mut Graph) -> Result<bool, Self::Error>
Sequential scheduler-driven step for debug/test single-tick use.
For each node, consults SimpleBackoffScheduler using the stored
per-node last_step to decide whether to step. This ensures the
same scheduling policy governs both step() and run().
WaitMicros decisions are treated as “skip this tick” — the
last_step is then cleared so the scheduler returns Step on
the next step() call. This avoids permanent starvation in
sequential mode where there is no real time passage between ticks.
Source§fn run(&mut self, graph: &mut Graph) -> Result<(), Self::Error>
fn run(&mut self, graph: &mut Graph) -> Result<(), Self::Error>
Concurrent execution via ScopedGraphApi::run_scoped.
Creates a SimpleBackoffScheduler and delegates to the graph’s
scoped thread infrastructure. Each node gets its own thread;
the scheduler controls per-worker stepping.
After all threads join, refreshes the occupancy snapshot.
Source§type Error = RuntimeError
type Error = RuntimeError
core::convert::Infallible if none.Source§type StopHandle = RuntimeStopHandle
type StopHandle = RuntimeStopHandle
Clone + Send + Sync + 'static.
Only available under std.Source§fn init(
&mut self,
graph: &mut Graph,
clock: Self::Clock,
telemetry: Self::Telemetry,
) -> Result<(), Self::Error>
fn init( &mut self, graph: &mut Graph, clock: Self::Clock, telemetry: Self::Telemetry, ) -> Result<(), Self::Error>
Source§fn reset(&mut self, graph: &Graph) -> Result<(), Self::Error>
fn reset(&mut self, graph: &Graph) -> Result<(), Self::Error>
Source§fn request_stop(&mut self)
fn request_stop(&mut self)
Source§fn stop_handle(&self) -> Option<Self::StopHandle>
fn stop_handle(&self) -> Option<Self::StopHandle>
run() to enable stopping from another thread.Source§fn is_stopping(&self) -> bool
fn is_stopping(&self) -> bool
true iff a stop has been requested.