intrepid_model

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;

    // 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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