pub struct BatchOptions {
pub max_lines: NonZero<usize>,
pub target_bytes: NonZero<usize>,
pub max_delay: Duration,
}Available on crate feature
std only.Expand description
Transport batching policy, independent of subprocess options and listing limits.
Defaults are 256 lines, a 256 KiB byte target, and 10 ms from adding the first complete line to a new batch. The first threshold reached flushes the batch. Counts are nonzero by construction. One oversized line is emitted alone; lines are never split.
Fields§
§max_lines: NonZero<usize>Maximum lines per batch, not a total result limit.
target_bytes: NonZero<usize>Typical maximum serialized batch size. A larger single line is allowed.
max_delay: DurationMaximum time spent collecting more lines after starting a batch, while the stream is being polled. Downstream backpressure still applies. Zero emits each line immediately. No empty timer batches are emitted.
Implementations§
Source§impl BatchOptions
impl BatchOptions
Sourcepub fn new(
max_lines: usize,
target_bytes: usize,
max_delay: Duration,
) -> Result<BatchOptions, TryFromIntError>
pub fn new( max_lines: usize, target_bytes: usize, max_delay: Duration, ) -> Result<BatchOptions, TryFromIntError>
Creates a policy, rejecting zero line/byte thresholds.
use asimov_flow::BatchOptions;
use std::time::Duration;
let options = BatchOptions::new(128, 64 * 1024, Duration::from_millis(5))?;
assert_eq!(options.max_lines.get(), 128);Trait Implementations§
Source§impl Clone for BatchOptions
impl Clone for BatchOptions
Source§fn clone(&self) -> BatchOptions
fn clone(&self) -> BatchOptions
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 BatchOptions
Source§impl Debug for BatchOptions
impl Debug for BatchOptions
Source§impl Default for BatchOptions
impl Default for BatchOptions
Source§fn default() -> BatchOptions
fn default() -> BatchOptions
Returns the “default value” for a type. Read more
impl Eq for BatchOptions
Source§impl PartialEq for BatchOptions
impl PartialEq for BatchOptions
impl StructuralPartialEq for BatchOptions
Auto Trait Implementations§
impl Freeze for BatchOptions
impl RefUnwindSafe for BatchOptions
impl Send for BatchOptions
impl Sync for BatchOptions
impl Unpin for BatchOptions
impl UnsafeUnpin for BatchOptions
impl UnwindSafe for BatchOptions
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