pub struct WaitEngine { /* private fields */ }Expand description
Drives Waiting flows back into Running (or Cancelled) based on
their WaitCondition.
The engine is intentionally minimal — no broker, no internal scheduler.
tick() is pull-based and idempotent; the host (or Phase 7 heartbeat)
invokes it on whatever cadence is appropriate. run(interval, shutdown)
is provided as a convenience for the common case.
Implementations§
Source§impl WaitEngine
impl WaitEngine
pub fn new(manager: FlowManager) -> Self
pub fn manager(&self) -> &FlowManager
Sourcepub async fn tick_at(&self, now: DateTime<Utc>) -> TickReport
pub async fn tick_at(&self, now: DateTime<Utc>) -> TickReport
Single pass over all Waiting flows. Returns counters for telemetry.
now is injected for deterministic testing — callers in production
should pass Utc::now().
pub async fn tick(&self) -> TickReport
Sourcepub async fn try_resume_external(
&self,
flow_id: Uuid,
topic: &str,
correlation_id: &str,
payload: Option<Value>,
) -> Result<Option<Flow>, FlowError>
pub async fn try_resume_external( &self, flow_id: Uuid, topic: &str, correlation_id: &str, payload: Option<Value>, ) -> Result<Option<Flow>, FlowError>
Host-driven resume for ExternalEvent waits. Invoked when (e.g.) a
NATS subscriber receives a message and resolves it to a flow.
Returns:
Ok(Some(flow))when the flow matched and was resumedOk(None)when no flow matched (no-op for caller)Err(_)for store/manager errors that the caller should log
Sourcepub async fn run(&self, interval: Duration, shutdown: CancellationToken)
pub async fn run(&self, interval: Duration, shutdown: CancellationToken)
Long-running tick loop. Stops cleanly when shutdown.cancelled()
fires. Logs each tick at debug level.
Trait Implementations§
Source§impl Clone for WaitEngine
impl Clone for WaitEngine
Source§fn clone(&self) -> WaitEngine
fn clone(&self) -> WaitEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WaitEngine
impl !RefUnwindSafe for WaitEngine
impl Send for WaitEngine
impl Sync for WaitEngine
impl Unpin for WaitEngine
impl UnsafeUnpin for WaitEngine
impl !UnwindSafe for WaitEngine
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
Mutably borrows from an owned value. Read more
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: 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>
Converts
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>
Converts
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