pub struct EventsBySlicesSourceProvider { /* private fields */ }Expand description
PostgreSQL timestamp-cursor provider over EventsBySlicesQuery.
The provider manifest durably includes the caller-supplied query identity,
entity type, inclusive slice range, and range version. A cursor written for
any different range or version therefore fails with
ProjectionError::ProviderManifestMismatch instead of being silently
reused. query_identity should be a stable, non-secret identifier for the
PostgreSQL journal/database (for example, a deployment database id plus
schema), so cursors are not accidentally moved across databases.
PostgreSQL resumes timestamp offsets inclusively. The provider stores every
consumed (persistence_id, sequence_nr) at the exact boundary in
DeduplicationBoundary. PostgreSQL’s projection offset store normalizes
those identities into PJ4’s timestamp-boundary table; no second dedup row
shape is introduced here.
Delivery guarantees cover only emitted rows. A live PostgreSQL slice query can permanently skip an event committed by a transaction open longer than the configured visibility lag.
Implementations§
Source§impl EventsBySlicesSourceProvider
impl EventsBySlicesSourceProvider
Sourcepub fn new(
query: Arc<dyn EventsBySlicesQuery>,
query_identity: impl Into<String>,
entity_type: impl Into<String>,
range: SliceRange,
version: u32,
) -> ProjectionResult<Self>
pub fn new( query: Arc<dyn EventsBySlicesQuery>, query_identity: impl Into<String>, entity_type: impl Into<String>, range: SliceRange, version: u32, ) -> ProjectionResult<Self>
Creates an inert, restartable provider for one versioned slice range.
Sourcepub fn query_identity(&self) -> &str
pub fn query_identity(&self) -> &str
Returns the stable query/database identity included in the manifest.
Sourcepub fn entity_type(&self) -> &str
pub fn entity_type(&self) -> &str
Returns the queried persistence entity type.
Sourcepub const fn range(&self) -> SliceRange
pub const fn range(&self) -> SliceRange
Returns the inclusive slice range owned by this provider.
Sourcepub fn projection_key(&self) -> &str
pub fn projection_key(&self) -> &str
Returns the range-derived projection key, such as slices-256-511@v1.
Trait Implementations§
Source§impl Clone for EventsBySlicesSourceProvider
impl Clone for EventsBySlicesSourceProvider
Source§impl SourceProvider<EventEnvelope> for EventsBySlicesSourceProvider
impl SourceProvider<EventEnvelope> for EventsBySlicesSourceProvider
Source§fn manifest(&self) -> &ProviderManifest
fn manifest(&self) -> &ProviderManifest
Source§fn validate_projection_id(
&self,
projection_id: &ProjectionId,
) -> ProjectionResult<()>
fn validate_projection_id( &self, projection_id: &ProjectionId, ) -> ProjectionResult<()>
projection_id. Read moreSource§fn source_from<'life0, 'life1, 'async_trait>(
&'life0 self,
cursor: Option<&'life1 ProjectionCursor>,
mode: QueryMode,
) -> Pin<Box<dyn Future<Output = ProjectionResult<ProjectionSource<EventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn source_from<'life0, 'life1, 'async_trait>(
&'life0 self,
cursor: Option<&'life1 ProjectionCursor>,
mode: QueryMode,
) -> Pin<Box<dyn Future<Output = ProjectionResult<ProjectionSource<EventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
cursor. Read moreSource§fn extract_cursor(
&self,
envelope: &EventEnvelope,
) -> ProjectionResult<ProjectionCursor>
fn extract_cursor( &self, envelope: &EventEnvelope, ) -> ProjectionResult<ProjectionCursor>
envelope. Read moreSource§fn compare_positions(
&self,
left: &CursorPosition,
right: &CursorPosition,
) -> ProjectionResult<Ordering>
fn compare_positions( &self, left: &CursorPosition, right: &CursorPosition, ) -> ProjectionResult<Ordering>
Source§fn resume_allows(
&self,
cursor: &ProjectionCursor,
envelope: &Envelope,
) -> ProjectionResult<bool>
fn resume_allows( &self, cursor: &ProjectionCursor, envelope: &Envelope, ) -> ProjectionResult<bool>
envelope is after the already-consumed resume cursor. Read more