pub struct TestSourceProvider<Payload> { /* private fields */ }Expand description
Fresh-query test provider with optional inclusive resume and manual pacing.
Inclusive resume starts each materialization at the stored position, so all
events sharing that exact position are re-emitted. The runtime must use the
cursor’s (persistence_id, sequence_nr) boundary set to remove only the
identities already consumed.
Implementations§
Source§impl<Payload> TestSourceProvider<Payload>
impl<Payload> TestSourceProvider<Payload>
Sourcepub fn new(envelopes: Vec<TestEnvelope<Payload>>) -> Self
pub fn new(envelopes: Vec<TestEnvelope<Payload>>) -> Self
Creates a strictly-after-resume test provider.
Sourcepub fn inclusive(envelopes: Vec<TestEnvelope<Payload>>) -> Self
pub fn inclusive(envelopes: Vec<TestEnvelope<Payload>>) -> Self
Creates an inclusive-resume provider that re-emits boundary duplicates.
Sourcepub fn with_manual_pace(self) -> (Self, ManualPaceProbe)
pub fn with_manual_pace(self) -> (Self, ManualPaceProbe)
Adds manual demand pacing and returns its controlling probe.
Sourcepub fn without_manual_pace(self) -> Self
pub fn without_manual_pace(self) -> Self
Removes manual pacing from this provider clone.
Sourcepub fn push(&self, envelope: TestEnvelope<Payload>) -> ProjectionResult<()>
pub fn push(&self, envelope: TestEnvelope<Payload>) -> ProjectionResult<()>
Appends an envelope and wakes live materializations.
Sourcepub fn complete(&self) -> ProjectionResult<()>
pub fn complete(&self) -> ProjectionResult<()>
Completes live materializations once all currently appended data drains.
Sourcepub fn fail_next_materialization(
&self,
error: ProjectionError,
) -> ProjectionResult<()>
pub fn fail_next_materialization( &self, error: ProjectionError, ) -> ProjectionResult<()>
Fails the next fresh-query factory invocation.
Sourcepub fn fail_next_source_after(
&self,
after_envelopes: usize,
error: ProjectionError,
) -> ProjectionResult<()>
pub fn fail_next_source_after( &self, after_envelopes: usize, error: ProjectionError, ) -> ProjectionResult<()>
Fails the next materialized stream after after_envelopes emissions.
Sourcepub fn materializations(&self) -> ProjectionResult<usize>
pub fn materializations(&self) -> ProjectionResult<usize>
Returns the number of fresh sources materialized so far.
Trait Implementations§
Source§impl<Payload: Clone> Clone for TestSourceProvider<Payload>
impl<Payload: Clone> Clone for TestSourceProvider<Payload>
Source§impl<Payload> SourceProvider<TestEnvelope<Payload>> for TestSourceProvider<Payload>
impl<Payload> SourceProvider<TestEnvelope<Payload>> for TestSourceProvider<Payload>
Source§fn manifest(&self) -> &ProviderManifest
fn manifest(&self) -> &ProviderManifest
Source§fn source_from<'life0, 'life1, 'async_trait>(
&'life0 self,
cursor: Option<&'life1 ProjectionCursor>,
mode: QueryMode,
) -> Pin<Box<dyn Future<Output = ProjectionResult<ProjectionSource<TestEnvelope<Payload>>>> + 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<TestEnvelope<Payload>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
cursor. Read moreSource§fn extract_cursor(
&self,
envelope: &TestEnvelope<Payload>,
) -> ProjectionResult<ProjectionCursor>
fn extract_cursor( &self, envelope: &TestEnvelope<Payload>, ) -> ProjectionResult<ProjectionCursor>
envelope. Read moreSource§fn compare_positions(
&self,
left: &CursorPosition,
right: &CursorPosition,
) -> ProjectionResult<CmpOrdering>
fn compare_positions( &self, left: &CursorPosition, right: &CursorPosition, ) -> ProjectionResult<CmpOrdering>
Source§fn validate_projection_id(
&self,
_projection_id: &ProjectionId,
) -> ProjectionResult<()>
fn validate_projection_id( &self, _projection_id: &ProjectionId, ) -> ProjectionResult<()>
projection_id. Read moreSource§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