Struct re_log_types::DataTableBatcher
source · pub struct DataTableBatcher { /* private fields */ }
Expand description
Implements an asynchronous batcher that coalesces DataRow
s into DataTable
s based upon
the thresholds defined in the associated DataTableBatcherConfig
.
§Multithreading and ordering
DataTableBatcher
can be cheaply clone and used freely across any number of threads.
Internally, all operations are linearized into a pipeline:
- All operations sent by a given thread will take effect in the same exact order as that thread originally sent them in, from its point of view.
- There isn’t any well defined global order across multiple threads.
This means that e.g. flushing the pipeline (Self::flush_blocking
) guarantees that all
previous data sent by the calling thread has been batched and sent down the channel returned
by DataTableBatcher::tables
; no more, no less.
§Shutdown
The batcher can only be shutdown by dropping all instances of it, at which point it will automatically take care of flushing any pending data that might remain in the pipeline.
Shutting down cannot ever block.
Implementations§
source§impl DataTableBatcher
impl DataTableBatcher
sourcepub fn new(
config: DataTableBatcherConfig
) -> Result<Self, DataTableBatcherError>
pub fn new( config: DataTableBatcherConfig ) -> Result<Self, DataTableBatcherError>
Creates a new DataTableBatcher
using the passed in config
.
The returned object must be kept in scope: dropping it will trigger a clean shutdown of the batcher.
sourcepub fn push_row(&self, row: DataRow)
pub fn push_row(&self, row: DataRow)
Pushes a DataRow
down the batching pipeline.
This will call DataRow::compute_all_size_bytes
from the batching thread!
See DataTableBatcher
docs for ordering semantics and multithreading guarantees.
sourcepub fn flush_async(&self)
pub fn flush_async(&self)
Initiates a flush of the pipeline and returns immediately.
This does not wait for the flush to propagate (see Self::flush_blocking
).
See DataTableBatcher
docs for ordering semantics and multithreading guarantees.
sourcepub fn flush_blocking(&self)
pub fn flush_blocking(&self)
Initiates a flush the batching pipeline and waits for it to propagate.
See DataTableBatcher
docs for ordering semantics and multithreading guarantees.
Trait Implementations§
source§impl Clone for DataTableBatcher
impl Clone for DataTableBatcher
source§fn clone(&self) -> DataTableBatcher
fn clone(&self) -> DataTableBatcher
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for DataTableBatcher
impl !RefUnwindSafe for DataTableBatcher
impl Send for DataTableBatcher
impl Sync for DataTableBatcher
impl Unpin for DataTableBatcher
impl !UnwindSafe for DataTableBatcher
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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>
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>
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