pub struct EngineDispatcher { /* private fields */ }Expand description
Bridges mlua_flow_ir::AsyncDispatcher to the engine’s
start_task + dispatch_attempt_with pair. Holds one Operator session
token and one spawner, and spins up a fresh task per Step.ref, using
it as the agent name.
Constructed via with_spawner; each dispatch goes through
engine.dispatch_attempt_with(token, tid, spawner, run_id), carrying the
spawner per request. Nothing is stashed on engine-global state, so
multiple dispatchers can drive different Blueprints against the same
Engine in parallel without racing.
Optionally carries a RunContext (via Self::with_run, issue #13
run_id propagation): when present, every dispatched step’s run_id is
exposed to the worker through Ctx.meta.runtime["run_id"], and a
StepEntry is appended to RunRecord.step_entries once the step’s
outcome is known (dispatch is synchronous end-to-end here, so there is
no need for a separate event/notification mechanism — the entry is
written with its final status in one call).
Also carries the GH #21 Phase 2 named MetaDef pool (via
Self::with_step_metas) — the Step tier’s dispatch-time resolver;
see Self::dispatch’s doc for the full envelope contract.
GH #23: optionally carries the Blueprint’s StepNaming table (via
Self::with_step_naming, built once by
blueprint::compiler::Compiler::compile — see that type’s doc for the
full addressing-space narrative). When present, Self::dispatch
snapshots the same Arc into EngineState.step_namings for every
dispatched task, keyed by its freshly-minted StepId — the storage
half of the “construct once, read many” contract; Engine::step_naming_for
is the read-back accessor later consumers (GH #23 subtask-2/3) pull
from.
GH #27 (follow-up to #23): optionally also carries the Blueprint’s
ProjectionPlacement resolver (via Self::with_projection_placement,
built once by Compiler::compile) — the SAME snapshot-then-read-back
contract as StepNaming above, this time read back via
Engine::projection_placement_for.
Implementations§
Source§impl EngineDispatcher
impl EngineDispatcher
Sourcepub fn with_spawner(
engine: Engine,
op_token: CapToken,
spawner: Arc<dyn SpawnerAdapter>,
) -> Self
pub fn with_spawner( engine: Engine, op_token: CapToken, spawner: Arc<dyn SpawnerAdapter>, ) -> Self
Build a dispatcher with no run-level tracing (run_ctx = None),
no named MetaDefs (step_metas empty), and no StepNaming
table — the pre-existing behavior. Use Self::with_run /
Self::with_step_metas / Self::with_step_naming to opt into
any of them.
Sourcepub fn with_run(self, run_ctx: RunContext) -> Self
pub fn with_run(self, run_ctx: RunContext) -> Self
Attach a RunContext (builder style) so every dispatched step is
traced into RunRecord.step_entries and exposes its run_id via
Ctx.meta.runtime.
Sourcepub fn with_step_metas(self, step_metas: HashMap<String, Value>) -> Self
pub fn with_step_metas(self, step_metas: HashMap<String, Value>) -> Self
GH #21 Phase 2: attach the named MetaDef pool (Blueprint.metas,
resolved by service::task_launch::derive_step_metas into a
name -> ctx map) that Self::dispatch resolves $step_meta.ref
envelopes against. Unconditional to call — an empty map (the
pre-#21-Phase-2 default) makes every $step_meta.ref lookup miss
loudly, same as a Blueprint that never declares Blueprint.metas.
Sourcepub fn with_step_naming(self, step_naming: Arc<StepNaming>) -> Self
pub fn with_step_naming(self, step_naming: Arc<StepNaming>) -> Self
GH #23: attach the Blueprint’s StepNaming table (built once by
blueprint::compiler::Compiler::compile). None (the default via
Self::with_spawner) preserves pre-GH-#23 behavior byte-for-byte
— Self::dispatch simply skips the EngineState.step_namings
snapshot for every caller that never opts in (e.g. tests that build
an EngineDispatcher directly instead of going through
service::task_launch::TaskLaunchService::launch).
Sourcepub fn with_projection_placement(
self,
projection_placement: Arc<ProjectionPlacement>,
) -> Self
pub fn with_projection_placement( self, projection_placement: Arc<ProjectionPlacement>, ) -> Self
GH #27 (follow-up to #23): attach the Blueprint’s
ProjectionPlacement resolver (built once by
blueprint::compiler::Compiler::compile). None (the default via
Self::with_spawner) preserves pre-GH-#27 behavior byte-for-byte
— Self::dispatch simply skips the
EngineState.projection_placements snapshot for every caller that
never opts in, mirroring Self::with_step_naming’s contract.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EngineDispatcher
impl !UnwindSafe for EngineDispatcher
impl Freeze for EngineDispatcher
impl Send for EngineDispatcher
impl Sync for EngineDispatcher
impl Unpin for EngineDispatcher
impl UnsafeUnpin for EngineDispatcher
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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