pub struct ProjectionManager { /* private fields */ }Expand description
Projection manager handles multiple projections
Implementations§
Source§impl ProjectionManager
impl ProjectionManager
pub fn new() -> Self
pub fn with_metrics(metrics: Arc<MetricsRegistry>) -> Self
Sourcepub fn with_checkpoint_config(
self,
config: CheckpointConfig,
dir: PathBuf,
) -> Self
pub fn with_checkpoint_config( self, config: CheckpointConfig, dir: PathBuf, ) -> Self
Set checkpoint configuration and directory.
Sourcepub fn register(&mut self, projection: Arc<dyn Projection>)
pub fn register(&mut self, projection: Arc<dyn Projection>)
Register a new projection. If a checkpoint file exists on disk, restore
from it so that only events newer than last_event_timestamp need to be
replayed.
Sourcepub fn process_event(&self, event: &Event) -> Result<()>
pub fn process_event(&self, event: &Event) -> Result<()>
Process an event through all projections. Events at or before a projection’s restored checkpoint timestamp are skipped (they were already folded into the restored state).
Sourcepub fn checkpoint_all(&self) -> Result<()>
pub fn checkpoint_all(&self) -> Result<()>
Checkpoint all projections that support snapshotting.
Sourcepub fn get_projection(&self, name: &str) -> Option<Arc<dyn Projection>>
pub fn get_projection(&self, name: &str) -> Option<Arc<dyn Projection>>
Get a projection by name
Sourcepub fn list_projections(&self) -> Vec<(String, Arc<dyn Projection>)>
pub fn list_projections(&self) -> Vec<(String, Arc<dyn Projection>)>
List all projections
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProjectionManager
impl !RefUnwindSafe for ProjectionManager
impl Send for ProjectionManager
impl Sync for ProjectionManager
impl Unpin for ProjectionManager
impl UnsafeUnpin for ProjectionManager
impl !UnwindSafe for ProjectionManager
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