pub struct BatchProcessor { /* private fields */ }Expand description
Batch processor for aggregating events before transmission.
Implementations§
Source§impl BatchProcessor
impl BatchProcessor
Sourcepub fn from_config(config: &BufferConfig) -> Self
pub fn from_config(config: &BufferConfig) -> Self
Create from buffer configuration.
Sourcepub async fn add(&self, event: UdmEvent) -> Option<Vec<UdmEvent>>
pub async fn add(&self, event: UdmEvent) -> Option<Vec<UdmEvent>>
Add an event to the batch.
Returns Some(events) if the batch is ready to be sent.
Sourcepub async fn add_many(&self, new_events: Vec<UdmEvent>) -> Vec<Vec<UdmEvent>>
pub async fn add_many(&self, new_events: Vec<UdmEvent>) -> Vec<Vec<UdmEvent>>
Add multiple events.
Returns batches ready to be sent (may return multiple if events exceed batch size).
Sourcepub async fn should_flush(&self) -> bool
pub async fn should_flush(&self) -> bool
Check if the batch should be flushed.
Sourcepub async fn send_batch<T: Transport>(
&self,
transport: &T,
) -> PhyTraceResult<Option<BatchResult>>
pub async fn send_batch<T: Transport>( &self, transport: &T, ) -> PhyTraceResult<Option<BatchResult>>
Send the batch using a transport.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchProcessor
impl !RefUnwindSafe for BatchProcessor
impl Send for BatchProcessor
impl Sync for BatchProcessor
impl Unpin for BatchProcessor
impl !UnwindSafe for BatchProcessor
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