Skip to main content

ReadJournal

Trait ReadJournal 

Source
pub trait ReadJournal:
    Send
    + Sync
    + 'static {
    // Required method
    fn events_by_persistence_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        persistence_id: &'life1 str,
        from_sequence_nr: u64,
        to_sequence_nr: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn current_events_by_persistence_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        persistence_id: &'life1 str,
        from: u64,
        to: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn events_by_tag<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _tag: &'life1 str,
        _offset: Offset,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn current_events_by_tag<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tag: &'life1 str,
        offset: Offset,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn all_persistence_ids<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn current_persistence_ids<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn events_as_of<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pid: &'life1 str,
        _system_time_nanos: u128,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn events_valid_as_of<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pid: &'life1 str,
        _valid_time_nanos: u128,
        _system_time_nanos: u128,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Read-journal surface. current_* variants take a snapshot at call time; the non-current variants are tail-following (live) — backends that only support snapshots return the snapshot and let callers re-poll.

Required Methods§

Source

fn events_by_persistence_id<'life0, 'life1, 'async_trait>( &'life0 self, persistence_id: &'life1 str, from_sequence_nr: u64, to_sequence_nr: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replay events for a single persistence id, sequence-number bounded.

Provided Methods§

Source

fn current_events_by_persistence_id<'life0, 'life1, 'async_trait>( &'life0 self, persistence_id: &'life1 str, from: u64, to: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Snapshot variant of Self::events_by_persistence_id — default impl is identical (in-memory journals don’t tail).

Source

fn events_by_tag<'life0, 'life1, 'async_trait>( &'life0 self, _tag: &'life1 str, _offset: Offset, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

All events with a given tag, returned in offset order. Default impl is empty so backends without tag indexing don’t silently mis-behave.

Source

fn current_events_by_tag<'life0, 'life1, 'async_trait>( &'life0 self, tag: &'life1 str, offset: Offset, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn all_persistence_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Distinct persistence ids known to the backend. Default impl returns empty (backends without an id index opt in).

Source

fn current_persistence_ids<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn events_as_of<'life0, 'life1, 'async_trait>( &'life0 self, pid: &'life1 str, _system_time_nanos: u128, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

FR-8 — bitemporal system-time as-of query: return the events for pid as they were known to the system at system_time_nanos, excluding any later-recorded restatement (no lookahead).

The default impl has no notion of system time, so it falls back to the full current event list — only a backend that records a per-row system_time (e.g. the SQL provider) can honor the cutoff. Override to get a true as-of slice.

Source

fn events_valid_as_of<'life0, 'life1, 'async_trait>( &'life0 self, pid: &'life1 str, _valid_time_nanos: u128, _system_time_nanos: u128, ) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, JournalError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

FR-8 — full bitemporal slice: events for pid whose valid time is at or before valid_time_nanos, as known to the system at system_time_nanos. Distinguishes a corrected value (recorded later) from the value originally known at an earlier system time.

Default impl ignores both time axes (returns the current list); only the SQL backend provides the true bitemporal slice.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§