pub struct ClickHouseWriter { /* private fields */ }Expand description
Background ClickHouse writer with bounded-channel backpressure.
Created via ClickHouseWriter::new. Batches are sent to the background
thread via send. Call shutdown to drain
the channel and wait for completion.
Implementations§
Source§impl ClickHouseWriter
impl ClickHouseWriter
Sourcepub fn new(
config: ClickHouseConfig,
capacity: usize,
) -> Result<Self, ClickHouseError>
pub fn new( config: ClickHouseConfig, capacity: usize, ) -> Result<Self, ClickHouseError>
Create a new writer with bounded channel of capacity batches for backpressure.
Spawns a background thread that drains the channel and sends batches to ClickHouse.
Sourcepub fn send(&self, batch: RecordBatch) -> Result<(), ClickHouseError>
pub fn send(&self, batch: RecordBatch) -> Result<(), ClickHouseError>
Send a batch to the background writer.
Blocks if the channel is full (backpressure).
Sourcepub fn metrics(&self) -> WriterMetricsSnapshot
pub fn metrics(&self) -> WriterMetricsSnapshot
Snapshot current writer metrics without shutting the writer down.
Sourcepub fn shutdown(self) -> WriterStats
pub fn shutdown(self) -> WriterStats
Shutdown the writer, drain remaining batches, and return statistics.
Auto Trait Implementations§
impl Freeze for ClickHouseWriter
impl !RefUnwindSafe for ClickHouseWriter
impl Send for ClickHouseWriter
impl Sync for ClickHouseWriter
impl Unpin for ClickHouseWriter
impl UnsafeUnpin for ClickHouseWriter
impl !UnwindSafe for ClickHouseWriter
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