Module saga_dispatch

Module saga_dispatch 

Source

Structs§

LiveActionRunner
SagaIdempotencyLru
Idempotency LRU keyed by (saga_id, CommandKind). Stores the resulting Report* Command so a duplicate dispatch re-emits the same reply payload without re-running the action.

Enums§

CommandKind
Discriminator for the host-bound saga command variants. Tracks the three commands the host actually consumes today (SpawnPoolWindow, ReapPanes, DrainPoolIfLast); future host- bound commands add a variant here.
DispatchOutcome
Outcome of dispatch_host_command: tells the caller whether the dispatch was a fresh execution (action ran, Report was inserted

Constants§

SAGA_LRU_CAP
Maximum number of (saga_id, kind) entries held in the LRU. Spec §3.7: bound 256 — far above any realistic concurrent saga count.

Traits§

SagaActionRunner
Dispatcher trait — abstracted so tests can inject a fake action runner without spawning real CEF windows. Production code uses LiveActionRunner which calls into commands::window_pool / host close-path code.

Functions§

build_and_run_report 🔒
Run the action for cmd and synthesize the corresponding Report* Command. saga_id_for_report is what the Report’s echo field carries — Some(N) when the dispatch was saga-driven, None for the no-saga bypass path.
dispatch_host_command
Dispatch a host-bound saga Command: check the LRU, run the action if not cached, build the corresponding Report*, cache it, and send via reply_tx. Returns the outcome so callers can log / count fresh vs. duplicate dispatch.