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).
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) —
the pre-existing behavior. Use Self::with_run to opt into
RunRecord.step_entries tracing / ctx.meta.runtime["run_id"].
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.
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