Skip to main content

EventStore

Trait EventStore 

Source
pub trait EventStore: Send + Sync {
    // Required methods
    fn ensure_namespace<'life0, 'life1, 'async_trait, N>(
        &'life0 self,
        namespace: &'life1 N,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where N: 'async_trait + Namespace,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn persist_next<'life0, 'life1, 'life2, 'async_trait, N>(
        &'life0 self,
        namespace: &'life1 N,
        payload: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<StreamEvent>> + Send + 'async_trait>>
       where N: 'async_trait + Namespace,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn load_history<'life0, 'life1, 'async_trait, N>(
        &'life0 self,
        namespace: &'life1 N,
        limit: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StreamEvent>>> + Send + 'async_trait>>
       where N: 'async_trait + Namespace,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_after_version<'life0, 'life1, 'async_trait, N>(
        &'life0 self,
        namespace: &'life1 N,
        after_version: EventVersion,
        limit: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StreamEvent>>> + Send + 'async_trait>>
       where N: 'async_trait + Namespace,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn latest_version<'life0, 'life1, 'async_trait, N>(
        &'life0 self,
        namespace: &'life1 N,
    ) -> Pin<Box<dyn Future<Output = Result<Option<EventVersion>>> + Send + 'async_trait>>
       where N: 'async_trait + Namespace,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persistent event storage keyed by namespace.

Required Methods§

Source

fn ensure_namespace<'life0, 'life1, 'async_trait, N>( &'life0 self, namespace: &'life1 N, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where N: 'async_trait + Namespace, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Ensure storage exists for the namespace.

Source

fn persist_next<'life0, 'life1, 'life2, 'async_trait, N>( &'life0 self, namespace: &'life1 N, payload: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<StreamEvent>> + Send + 'async_trait>>
where N: 'async_trait + Namespace, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Allocate the next monotonic version and persist the event atomically.

Source

fn load_history<'life0, 'life1, 'async_trait, N>( &'life0 self, namespace: &'life1 N, limit: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<StreamEvent>>> + Send + 'async_trait>>
where N: 'async_trait + Namespace, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load up to limit most recent events in ascending version order.

Source

fn load_after_version<'life0, 'life1, 'async_trait, N>( &'life0 self, namespace: &'life1 N, after_version: EventVersion, limit: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<StreamEvent>>> + Send + 'async_trait>>
where N: 'async_trait + Namespace, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load events with version strictly greater than after_version.

Source

fn latest_version<'life0, 'life1, 'async_trait, N>( &'life0 self, namespace: &'life1 N, ) -> Pin<Box<dyn Future<Output = Result<Option<EventVersion>>> + Send + 'async_trait>>
where N: 'async_trait + Namespace, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Latest assigned version for the namespace, if any events exist.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§