pub struct Projector<C, P>where
C: CanonicalStore,
P: ProjectionStore,{ /* private fields */ }Expand description
Projector: consumes events from canonical store and applies to projection
Implementations§
Source§impl<C, P> Projector<C, P>where
C: CanonicalStore,
P: ProjectionStore,
impl<C, P> Projector<C, P>where
C: CanonicalStore,
P: ProjectionStore,
pub fn new( canonical: Arc<C>, projection: Arc<P>, config: ProjectorConfig, ) -> Self
Sourcepub fn with_event_notify(self, notify: Arc<Notify>) -> Self
pub fn with_event_notify(self, notify: Arc<Notify>) -> Self
Attach an event notification handle for push-based projection.
When set, run_continuous() awaits this notification instead of
sleeping for poll_interval_ms when caught up, giving near-zero
latency event processing with zero idle CPU usage.
Sourcepub fn run_once(&self) -> Result<ProjectorStats>
pub fn run_once(&self) -> Result<ProjectorStats>
Run one iteration of the projector loop.
Fetches a batch of events from the canonical store and applies them to the projection. Detects and tolerates event ID gaps: if the event log is missing events (e.g. due to DLQ fallback), the projector logs a warning and advances past the gap instead of blocking.
Sourcepub async fn run_continuous(&self) -> Result<()>
pub async fn run_continuous(&self) -> Result<()>
Run the projector continuously until shutdown.
When an event_notify handle is set (via Self::with_event_notify),
the projector awaits the notification instead of polling, giving
near-zero-latency projection with zero CPU waste when idle.
Falls back to poll_interval_ms sleep if no notifier is present.
Sourcepub fn total_gaps_detected(&self) -> u64
pub fn total_gaps_detected(&self) -> u64
Returns the total number of event ID gaps detected across all iterations.
Sourcepub fn total_events_skipped(&self) -> u64
pub fn total_events_skipped(&self) -> u64
Returns the total number of individual event IDs that were skipped due to gaps.