pub struct PostgresProjectionConfig { /* private fields */ }Expand description
Settings for a transactional PostgreSQL projection run.
Implementations§
Source§impl PostgresProjectionConfig
impl PostgresProjectionConfig
Sourcepub fn new(selection: ProjectionSelection) -> Self
pub fn new(selection: ProjectionSelection) -> Self
Creates configuration with the default batch execution policy.
The defaults are batch mode, a page size of 100 envelopes, no retries, a 100 millisecond
initial retry delay, a 2.0 retry multiplier, a 30 second retry-delay cap, and a 1 second
continuous idle interval. Retry and continuous polling delays both use Tokio-backed
sleepers.
Sourcepub fn continuous(self, cancellation: CancellationToken) -> Self
pub fn continuous(self, cancellation: CancellationToken) -> Self
Changes this configuration to continuously poll until the token is cancelled.
Cancellation is observed only between completed catch-up cycles. It does not interrupt application, a retry delay, commit, or after-commit work already in progress.
Sourcepub fn with_batch_size(
self,
batch_size: BatchSize,
) -> Result<Self, ProjectionConfigurationError>
pub fn with_batch_size( self, batch_size: BatchSize, ) -> Result<Self, ProjectionConfigurationError>
Replaces the maximum number of source envelopes read in one page.
A zero batch size is rejected with ProjectionConfigurationError::ZeroBatchSize, because
an empty page would otherwise make the runner report false catch-up while selected
committed envelopes remain unapplied.
Sourcepub fn with_retry_policy(self, retry_policy: ProjectionRetryPolicy) -> Self
pub fn with_retry_policy(self, retry_policy: ProjectionRetryPolicy) -> Self
Replaces the retry policy.
Sourcepub fn with_retry_sleeper(
self,
retry_sleeper: impl ProjectionRetrySleeper + 'static,
) -> Self
pub fn with_retry_sleeper( self, retry_sleeper: impl ProjectionRetrySleeper + 'static, ) -> Self
Replaces the asynchronous delay implementation used between retry attempts.
Sourcepub fn with_poll_sleeper(
self,
poll_sleeper: impl ProjectionPollSleeper + 'static,
) -> Self
pub fn with_poll_sleeper( self, poll_sleeper: impl ProjectionPollSleeper + 'static, ) -> Self
Replaces the asynchronous delay implementation used between empty continuous polls.
Sourcepub fn with_continuous_poll_interval(
self,
continuous_poll_interval: Duration,
) -> Result<Self, ProjectionConfigurationError>
pub fn with_continuous_poll_interval( self, continuous_poll_interval: Duration, ) -> Result<Self, ProjectionConfigurationError>
Replaces the continuous runner’s idle interval.
An idle interval begins after a catch-up cycle reaches its captured committed frontier and
ends when the next cycle polls for a new frontier. It is not a delay between envelopes or
pages within a catch-up cycle. A zero interval is rejected with
ProjectionConfigurationError::ZeroContinuousPollInterval.
Sourcepub fn selection(&self) -> &ProjectionSelection
pub fn selection(&self) -> &ProjectionSelection
Returns the selected source contract.
Sourcepub fn batch_size(&self) -> BatchSize
pub fn batch_size(&self) -> BatchSize
Returns the page size.
Sourcepub fn mode(&self) -> &PostgresProjectionMode
pub fn mode(&self) -> &PostgresProjectionMode
Returns the execution mode.
Sourcepub fn retry_policy(&self) -> &ProjectionRetryPolicy
pub fn retry_policy(&self) -> &ProjectionRetryPolicy
Returns the retry policy.
Sourcepub fn retry_sleeper(&self) -> &(dyn ProjectionRetrySleeper + 'static)
pub fn retry_sleeper(&self) -> &(dyn ProjectionRetrySleeper + 'static)
Returns the configured retry delay implementation.
Sourcepub fn poll_sleeper(&self) -> &(dyn ProjectionPollSleeper + 'static)
pub fn poll_sleeper(&self) -> &(dyn ProjectionPollSleeper + 'static)
Returns the configured continuous idle delay implementation.
Sourcepub fn continuous_poll_interval(&self) -> Duration
pub fn continuous_poll_interval(&self) -> Duration
Returns the interval between empty continuous polls.
Trait Implementations§
Source§impl Clone for PostgresProjectionConfig
impl Clone for PostgresProjectionConfig
Source§fn clone(&self) -> PostgresProjectionConfig
fn clone(&self) -> PostgresProjectionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PostgresProjectionConfig
impl !UnwindSafe for PostgresProjectionConfig
impl Freeze for PostgresProjectionConfig
impl Send for PostgresProjectionConfig
impl Sync for PostgresProjectionConfig
impl Unpin for PostgresProjectionConfig
impl UnsafeUnpin for PostgresProjectionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more