pub struct ProjectionRegistry<E: Event, B: EventStoreBackend<E>> { /* private fields */ }Available on crate feature
cqrs only.Expand description
Projection Registry for managing multiple projections
Implementations§
Source§impl<E: Event, B: EventStoreBackend<E>> ProjectionRegistry<E, B>
impl<E: Event, B: EventStoreBackend<E>> ProjectionRegistry<E, B>
Sourcepub fn new(event_store: EventStore<E, B>) -> Self
pub fn new(event_store: EventStore<E, B>) -> Self
Create a new projection registry
Sourcepub async fn register<P: Projection<Event = E> + 'static>(
&self,
name: impl Into<String>,
projection: P,
)
pub async fn register<P: Projection<Event = E> + 'static>( &self, name: impl Into<String>, projection: P, )
Register a projection with automatic event subscription
Sourcepub async fn get<P: Projection<Event = E> + 'static>(
&self,
_name: &str,
) -> Option<Arc<RwLock<P>>>
pub async fn get<P: Projection<Event = E> + 'static>( &self, _name: &str, ) -> Option<Arc<RwLock<P>>>
Get a projection by name
Sourcepub async fn rebuild(&self, name: &str) -> Result<(), String>
pub async fn rebuild(&self, name: &str) -> Result<(), String>
Rebuild a specific projection from scratch
Sourcepub async fn rebuild_all(&self) -> Result<(), String>
pub async fn rebuild_all(&self) -> Result<(), String>
Rebuild all projections from scratch
Sourcepub async fn get_metadata(&self, name: &str) -> Option<ProjectionMetadata>
pub async fn get_metadata(&self, name: &str) -> Option<ProjectionMetadata>
Get metadata for a projection
Sourcepub async fn get_all_metadata(&self) -> Vec<ProjectionMetadata>
pub async fn get_all_metadata(&self) -> Vec<ProjectionMetadata>
Get metadata for all projections
Sourcepub async fn start_subscription(&self) -> Result<(), String>
pub async fn start_subscription(&self) -> Result<(), String>
Subscribe projections to new events
Trait Implementations§
Source§impl<E: Event, B: EventStoreBackend<E>> Clone for ProjectionRegistry<E, B>
impl<E: Event, B: EventStoreBackend<E>> Clone for ProjectionRegistry<E, B>
Auto Trait Implementations§
impl<E, B> Freeze for ProjectionRegistry<E, B>
impl<E, B> !RefUnwindSafe for ProjectionRegistry<E, B>
impl<E, B> Send for ProjectionRegistry<E, B>
impl<E, B> Sync for ProjectionRegistry<E, B>
impl<E, B> Unpin for ProjectionRegistry<E, B>where
E: Unpin,
impl<E, B> !UnwindSafe for ProjectionRegistry<E, B>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request