run_projection

Function run_projection 

Source
pub async fn run_projection<P, B>(
    projector: P,
    backend: &B,
) -> Result<(), ProjectionError>
Expand description

Runs a projector against a backend that provides events, checkpoints, and coordination.

This is the primary entry point for running projections in EventCore. It orchestrates:

  • Leadership acquisition via ProjectorCoordinator
  • Event reading via EventReader
  • Checkpoint management via CheckpointStore

§Arguments

  • projector - The projector implementation to run
  • backend - A reference to a backend implementing EventReader, CheckpointStore, and ProjectorCoordinator

§Returns

Returns when the projector completes processing all events (batch mode), is cancelled, or encounters a fatal error.

§Example

// PostgreSQL provides all three traits
run_projection(my_projector, &postgres_store).await?;