pub struct BatchBuilder { /* private fields */ }Expand description
Builder for constructing batches of events with efficient serialization.
Implementations§
Source§impl BatchBuilder
impl BatchBuilder
Sourcepub const DEFAULT_MAX_EVENTS: usize = 1000
pub const DEFAULT_MAX_EVENTS: usize = 1000
Default maximum events per batch.
Sourcepub const DEFAULT_MAX_BYTES: usize = 1_000_000
pub const DEFAULT_MAX_BYTES: usize = 1_000_000
Default maximum bytes per batch (1MB).
Sourcepub fn max_events(self, max: usize) -> Self
pub fn max_events(self, max: usize) -> Self
Set the maximum number of events per batch.
Sourcepub fn add_event(&mut self, event: DatabaseEvent) -> Option<DatabaseEventBatch>
pub fn add_event(&mut self, event: DatabaseEvent) -> Option<DatabaseEventBatch>
Add an event to the batch. Returns Some(batch) if the batch is full and was flushed.
Sourcepub fn add_relation(&mut self, meta: RelationMeta)
pub fn add_relation(&mut self, meta: RelationMeta)
Add relation metadata to the batch.
Sourcepub fn flush(&mut self) -> DatabaseEventBatch
pub fn flush(&mut self) -> DatabaseEventBatch
Flush the current batch and return it.
Sourcepub fn finish(self) -> Option<DatabaseEventBatch>
pub fn finish(self) -> Option<DatabaseEventBatch>
Finish building and return any remaining events as a batch.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchBuilder
impl RefUnwindSafe for BatchBuilder
impl Send for BatchBuilder
impl Sync for BatchBuilder
impl Unpin for BatchBuilder
impl UnsafeUnpin for BatchBuilder
impl UnwindSafe for BatchBuilder
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