#[non_exhaustive]pub enum FlushPolicy {
Batch(usize),
Interval(Duration),
BatchOrInterval {
batch_size: usize,
interval: Duration,
},
Manual,
}Expand description
When to auto-flush pending items from memory to a segment file.
Passed to SegmentConfig via its flush_policy field. Replaces the
pre-v0.4.0 silent combination of two separate fields (max_batch_events
and flush_interval_secs) that OR’d together without telling the caller
which trigger fired.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Batch(usize)
Flush as soon as batch_size items are buffered. No interval trigger.
Interval(Duration)
Flush as soon as interval has elapsed since the last flush. No batch
trigger.
BatchOrInterval
Flush when EITHER batch_size items are buffered OR interval has
elapsed since the last flush — whichever fires first. This is the
pre-v0.4.0 default behavior.
Fields
Manual
Never auto-flush. The caller must call SegmentBuffer::flush
explicitly to make appends durable. Useful for tests and for callers
that want absolute control over write amplification.
Trait Implementations§
Source§impl Clone for FlushPolicy
impl Clone for FlushPolicy
Source§fn clone(&self) -> FlushPolicy
fn clone(&self) -> FlushPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more