Struct intrepid_model::IntrepidConnection

source ·
pub struct IntrepidConnection<Repo> {
    pub repo: Repo,
}
Expand description

A connection to an intrepid repository that combines the functionality of a cache and an event connection.

Fields§

§repo: Repo

The underlying repository.

Implementations§

source§

impl<Repo> IntrepidConnection<Repo>
where Repo: InterpidRepo + Clone + Send + Sync + 'static,

source

pub fn new(repo: Repo) -> Self

Create a new connection.

source

pub fn event_connection( &self, target_stream_name: impl AsRef<str> + Send, own_stream_name: impl AsRef<str> + Send, ) -> EventConnection<Repo>

Accept a stream name and marker stream name, and return an event connection

source

pub fn cache_connection(&self) -> CacheConnection<Repo>

Get a cache connection

source

pub fn into_inner(self) -> Repo

Consume the connection and return the inner repository

Trait Implementations§

source§

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

source§

fn get_memo<'life0, 'async_trait>( &'life0 self, uri: impl 'async_trait + AsRef<str> + Send, ) -> Pin<Box<dyn Future<Output = Result<Cache<CacheRecord>, CacheRepoError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a memo by URI
source§

fn set_memo<'life0, 'async_trait, CacheCandidate>( &'life0 self, record: CacheCandidate, ) -> Pin<Box<dyn Future<Output = Result<CacheRecord, CacheRepoError>> + Send + 'async_trait>>
where CacheCandidate: IntoCache + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Set a memo with any type that implements IntoCache
source§

impl<Repo: Clone> Clone for IntrepidConnection<Repo>

source§

fn clone(&self) -> IntrepidConnection<Repo>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Repo: Debug> Debug for IntrepidConnection<Repo>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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

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

Auto Trait Implementations§

§

impl<Repo> Freeze for IntrepidConnection<Repo>
where Repo: Freeze,

§

impl<Repo> RefUnwindSafe for IntrepidConnection<Repo>
where Repo: RefUnwindSafe,

§

impl<Repo> Send for IntrepidConnection<Repo>
where Repo: Send,

§

impl<Repo> Sync for IntrepidConnection<Repo>
where Repo: Sync,

§

impl<Repo> Unpin for IntrepidConnection<Repo>
where Repo: Unpin,

§

impl<Repo> UnwindSafe for IntrepidConnection<Repo>
where Repo: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> InterpidRepo for T
where T: CacheRepo + EventRepo,