Skip to main content

EventRepo

Trait EventRepo 

Source
pub trait EventRepo {
    // Required methods
    fn entries_since_position<'life0, 'async_trait>(
        &'life0 self,
        stream_name: impl 'async_trait + AsRef<str> + Send,
        position: i64,
    ) -> Pin<Box<dyn Future<Output = Result<EventLog, EventRepoError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish<'life0, 'async_trait, EventCandidate>(
        &'life0 self,
        event: EventCandidate,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventRepoError>> + Send + 'async_trait>>
       where EventCandidate: IntoEvent + Send + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn last<'life0, 'async_trait>(
        &'life0 self,
        stream_name: impl 'async_trait + AsRef<str> + Send,
        kind: EventKind,
    ) -> Pin<Box<dyn Future<Output = Option<EventRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The trait for an event repository. Implement this trait to provide an event repository interface for any given event storage implementation.

Required Methods§

Source

fn entries_since_position<'life0, 'async_trait>( &'life0 self, stream_name: impl 'async_trait + AsRef<str> + Send, position: i64, ) -> Pin<Box<dyn Future<Output = Result<EventLog, EventRepoError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all entries in the stream since the given position.

Source

fn publish<'life0, 'async_trait, EventCandidate>( &'life0 self, event: EventCandidate, ) -> Pin<Box<dyn Future<Output = Result<(), EventRepoError>> + Send + 'async_trait>>
where EventCandidate: IntoEvent + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Publish an event to the target stream.

Source

fn last<'life0, 'async_trait>( &'life0 self, stream_name: impl 'async_trait + AsRef<str> + Send, kind: EventKind, ) -> Pin<Box<dyn Future<Output = Option<EventRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the last event in the stream.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§