Skip to main content

LoadState

Trait LoadState 

Source
pub trait LoadState<ID: EventId, S, E: Event + Clone> {
    // Required method
    fn load<'life0, 'async_trait>(
        &'life0 self,
        state_query: S,
    ) -> Pin<Box<dyn Future<Output = Result<LoadedState<ID, S>, BoxDynError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait to load a state.

This trait for loading a state from the storage backend.

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, state_query: S, ) -> Pin<Box<dyn Future<Output = Result<LoadedState<ID, S>, BoxDynError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads the state based on the provided state query.

This method retrieves a state from the storage backend, along with its version.

§Parameters
  • state_query: The query object representing the desired state to hydrate.
§Returns

the loaded state, or an error if the load fails.

Implementors§

Source§

impl<ID, ES, E, S> LoadState<ID, S, E> for EventSourcedStateStore<ID, E, ES, NoSnapshot>
where ES: EventStore<ID, E> + Clone + Sync + Send, <ES as EventStore<ID, E>>::Error: StdError + Send + Sync + 'static, ID: EventId, E: Event + Clone + Send + Sync + 'static, S: Send + Sync + Serialize + DeserializeOwned + IntoStatePart<ID, S> + 'static, <S as IntoStatePart<ID, S>>::Target: Send + Sync + Serialize + DeserializeOwned + IntoState<S> + MultiState<ID, E>,

Source§

impl<ID, ES, E, S, B> LoadState<ID, S, E> for EventSourcedStateStore<ID, E, ES, WithSnapshot<ID, B>>
where ID: EventId, B: StateSnapshotter<ID> + Send + Sync + Clone, ES: EventStore<ID, E> + Clone + Sync + Send, <ES as EventStore<ID, E>>::Error: StdError + Send + Sync + 'static, E: Event + Clone + Send + Sync + 'static, S: Send + Sync + Serialize + DeserializeOwned + IntoStatePart<ID, S> + 'static, <S as IntoStatePart<ID, S>>::Target: Send + Sync + Serialize + DeserializeOwned + IntoState<S> + MultiState<ID, E> + MultiStateSnapshot<ID, B>,