Expand description
EventDrivenController — generic adapter that ticks a wrapped
Controller on every received event.
Bridges any tokio broadcast channel (engenho-store WatchEvent,
engenho-substrate CacheEvent, custom event sources) into the
Controller trait surface — controllers no longer need to poll
when the upstream can notify.
§Reconcile semantics
tick()onEventDrivenController= drain pending events + issue ONE downstreamtick()per event (or one per batch whencoalesce: true).- Lagged subscribers (broadcast capacity overflow) → ignored; one extra tick scheduled to catch up.
- Closed channels → returns Ok with the count of events processed before close. Subsequent ticks no-op until the receiver is resubscribed.
§When to use
- Wrap
DrvControllerso it ticks onCacheEvent::RealisationUpsertedinstead of running on every interval. - Wrap any Controller whose upstream emits typed events.
§When NOT to use
- Controllers whose state isn’t event-derived (
TickEveryis fine for those). - Cross-cluster federation paths where event order isn’t guaranteed (use a reconcile loop with full-list reads).
Structs§
- Event
Driven Controller - Generic wrapper that drains an event channel + issues ticks.