pub struct MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error>,
View: ViewStateComputation<E, S>,{ /* private fields */ }
Expand description
Materialized View.
It is using a View
/ ViewStateComputation to compute new state based on the current state and the event.
It is using a ViewStateRepository to fetch the current state and to save the new state.
Generic parameters:
S
- StateE
- EventRepository
- View State repositoryView
- ViewError
- Error
Implementations§
Source§impl<S, E, Repository, View, Error> MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error> + Sync,
View: ViewStateComputation<E, S> + Sync,
E: Sync,
S: Sync,
Error: Sync,
impl<S, E, Repository, View, Error> MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error> + Sync,
View: ViewStateComputation<E, S> + Sync,
E: Sync,
S: Sync,
Error: Sync,
Sourcepub fn new(repository: Repository, view: View) -> Self
pub fn new(repository: Repository, view: View) -> Self
Creates a new instance of MaterializedView.
Trait Implementations§
Source§impl<S, E, Repository, View, Error> ViewStateComputation<E, S> for MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error>,
View: ViewStateComputation<E, S>,
impl<S, E, Repository, View, Error> ViewStateComputation<E, S> for MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error>,
View: ViewStateComputation<E, S>,
Source§fn compute_new_state(&self, current_state: Option<S>, events: &[&E]) -> S
fn compute_new_state(&self, current_state: Option<S>, events: &[&E]) -> S
Computes new state based on the current state and the events.
Source§impl<S, E, Repository, View, Error> ViewStateRepository<E, S, Error> for MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error> + Sync,
View: ViewStateComputation<E, S> + Sync,
E: Sync,
S: Sync,
Error: Sync,
impl<S, E, Repository, View, Error> ViewStateRepository<E, S, Error> for MaterializedView<S, E, Repository, View, Error>where
Repository: ViewStateRepository<E, S, Error> + Sync,
View: ViewStateComputation<E, S> + Sync,
E: Sync,
S: Sync,
Error: Sync,
Auto Trait Implementations§
impl<S, E, Repository, View, Error> Freeze for MaterializedView<S, E, Repository, View, Error>
impl<S, E, Repository, View, Error> RefUnwindSafe for MaterializedView<S, E, Repository, View, Error>where
Repository: RefUnwindSafe,
View: RefUnwindSafe,
S: RefUnwindSafe,
E: RefUnwindSafe,
Error: RefUnwindSafe,
impl<S, E, Repository, View, Error> Send for MaterializedView<S, E, Repository, View, Error>
impl<S, E, Repository, View, Error> Sync for MaterializedView<S, E, Repository, View, Error>
impl<S, E, Repository, View, Error> Unpin for MaterializedView<S, E, Repository, View, Error>
impl<S, E, Repository, View, Error> UnwindSafe for MaterializedView<S, E, Repository, View, Error>
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