pub struct AdaptiveBatcher<T> { /* private fields */ }Expand description
Adaptive batch accumulator for high-throughput ingestion
Automatically adjusts batch size based on throughput and latency.
Implementations§
Source§impl<T> AdaptiveBatcher<T>
impl<T> AdaptiveBatcher<T>
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new adaptive batcher
Sourcepub fn add(&self, item: T) -> Option<Vec<T>>
pub fn add(&self, item: T) -> Option<Vec<T>>
Add an item to the batch Returns Some(batch) if the batch should be flushed
Sourcepub fn needs_flush(&self) -> bool
pub fn needs_flush(&self) -> bool
Check if batch needs flushing due to time
Sourcepub fn current_batch_size(&self) -> usize
pub fn current_batch_size(&self) -> usize
Get current batch size setting
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get number of items currently in batch
Sourcepub fn stats(&self) -> BatcherStats
pub fn stats(&self) -> BatcherStats
Get statistics
Auto Trait Implementations§
impl<T> !Freeze for AdaptiveBatcher<T>
impl<T> !RefUnwindSafe for AdaptiveBatcher<T>
impl<T> Send for AdaptiveBatcher<T>where
T: Send,
impl<T> Sync for AdaptiveBatcher<T>where
T: Send,
impl<T> Unpin for AdaptiveBatcher<T>where
T: Unpin,
impl<T> UnwindSafe for AdaptiveBatcher<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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>
Converts
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>
Converts
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