pub struct GenericBatcher<T: ClickInsertable, C: ClickTypeTransport> { /* private fields */ }Expand description
The main entry point for batch ingestion.
GenericBatcher is responsible for configuring and spawning the background worker.
It is generic over the transport implementation C.
Implementations§
Source§impl<T, C> GenericBatcher<T, C>where
T: ClickInsertable + ClickTable + Send + Sync + 'static,
C: ClickTypeTransport + Send + Sync + 'static,
impl<T, C> GenericBatcher<T, C>where
T: ClickInsertable + ClickTable + Send + Sync + 'static,
C: ClickTypeTransport + Send + Sync + 'static,
Sourcepub fn new(client: C, config: BatchConfig) -> Self
pub fn new(client: C, config: BatchConfig) -> Self
Create a new batcher instance.
§Arguments
client- Configured ClickType client (or mock)config- Batching configuration
Sourcepub fn spawn(self) -> (BatcherHandle<T>, JoinHandle<()>)
pub fn spawn(self) -> (BatcherHandle<T>, JoinHandle<()>)
Spawn the batcher worker task.
Returns a tuple containing:
BatcherHandle: Used to insert data.JoinHandle: Used to supervise the worker task (detect panics or wait for completion).
§Example
ⓘ
let (handle, worker) = batcher.spawn();
handle.insert(data).await?;
handle.close().await?;
worker.await?; // Ensure clean exitAuto Trait Implementations§
impl<T, C> Freeze for GenericBatcher<T, C>where
C: Freeze,
impl<T, C> RefUnwindSafe for GenericBatcher<T, C>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for GenericBatcher<T, C>where
T: Send,
impl<T, C> Sync for GenericBatcher<T, C>where
T: Sync,
impl<T, C> Unpin for GenericBatcher<T, C>
impl<T, C> UnsafeUnpin for GenericBatcher<T, C>where
C: UnsafeUnpin,
impl<T, C> UnwindSafe for GenericBatcher<T, C>where
C: UnwindSafe,
T: UnwindSafe,
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