pub struct TimingFlushPolicy {
flush_interval: Duration,
max_batch_rows: usize,
}Expand description
Decides whether the first-submission deadline or row threshold requires a flush.
The row threshold is checked after appending a complete submission. It is not a hard batch-size limit and never splits a submission.
Fields§
§flush_interval: Duration§max_batch_rows: usizeImplementations§
Source§impl TimingFlushPolicy
impl TimingFlushPolicy
Sourcepub fn try_new(flush_interval: Duration, max_batch_rows: usize) -> Option<Self>
pub fn try_new(flush_interval: Duration, max_batch_rows: usize) -> Option<Self>
Creates a policy, rejecting zero limits, zero intervals, and unrepresentable deadlines.
Sourcepub fn validate(flush_interval: Duration) -> bool
pub fn validate(flush_interval: Duration) -> bool
Checks that the interval is nonzero and its deadline is representable.
Sourcepub fn reached_row_threshold<T>(&self, batch: &PendingBatch<T>) -> bool
pub fn reached_row_threshold<T>(&self, batch: &PendingBatch<T>) -> bool
Checks only the row trigger when a caller drives deadline events separately.
Trait Implementations§
Source§impl Clone for TimingFlushPolicy
impl Clone for TimingFlushPolicy
Source§fn clone(&self) -> TimingFlushPolicy
fn clone(&self) -> TimingFlushPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TimingFlushPolicy
Source§impl Debug for TimingFlushPolicy
impl Debug for TimingFlushPolicy
Source§impl FlushPolicy for TimingFlushPolicy
impl FlushPolicy for TimingFlushPolicy
Source§fn deadline<T>(&self, batch: &PendingBatch<T>) -> Option<Instant>
fn deadline<T>(&self, batch: &PendingBatch<T>) -> Option<Instant>
Returns the deadline anchored to the first submission, or None for an empty batch.
An unrepresentable deadline falls back to the first submission time so that extreme timestamps cannot leave a nonempty batch waiting indefinitely.
Source§fn should_flush<T>(
&self,
batch: &PendingBatch<T>,
now: Instant,
trigger: FlushTrigger,
) -> bool
fn should_flush<T>( &self, batch: &PendingBatch<T>, now: Instant, trigger: FlushTrigger, ) -> bool
Returns whether a nonempty batch has reached either trigger.
Auto Trait Implementations§
impl Freeze for TimingFlushPolicy
impl RefUnwindSafe for TimingFlushPolicy
impl Send for TimingFlushPolicy
impl Sync for TimingFlushPolicy
impl Unpin for TimingFlushPolicy
impl UnsafeUnpin for TimingFlushPolicy
impl UnwindSafe for TimingFlushPolicy
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
Mutably borrows from an owned value. Read more