Trait intrepid_model::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;

    // Provided methods
    fn log_last_read<'life0, 'async_trait>(
        &'life0 self,
        stream_name: impl 'async_trait + AsRef<str> + Send,
        subscriber_name: impl 'async_trait + AsRef<str> + Send,
        position: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventRepoError>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn last_read_position<'life0, 'async_trait>(
        &'life0 self,
        stream_name: impl 'async_trait + AsRef<str> + Send,
    ) -> Pin<Box<dyn Future<Output = i64> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn last_event_position<'life0, 'async_trait>(
        &'life0 self,
        stream_name: impl 'async_trait + AsRef<str> + Send,
    ) -> Pin<Box<dyn Future<Output = i64> + Send + 'async_trait>>
       where Self: Sync + '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.

Provided Methods§

source

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

Log the last read position for a subscriber. This leverages markers.

source

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

Get the last read position for a subscriber.

source

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

Get the last event position in the stream.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Repo> EventRepo for IntrepidConnection<Repo>
where Repo: InterpidRepo + Send + Sync,