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.
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) and
no named MetaDefs (step_metas empty) — the pre-existing
behavior. Use Self::with_run / Self::with_step_metas to
opt into either.
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.
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