pub struct ColumnarBuffer { /* private fields */ }Expand description
Columnar buffer with lazy field extraction.
This buffer stores events in both row and columnar format:
events: Original events preserved for predicates/emit operationstimestamps: Eagerly extracted timestamps for temporal operationscolumns: Lazily populated cache of extracted field columns
When an aggregation needs a field, the column is extracted once and cached for subsequent aggregations on the same field.
Implementations§
Source§impl ColumnarBuffer
impl ColumnarBuffer
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new columnar buffer with the specified capacity.
Sourcepub fn push(&mut self, event: SharedEvent)
pub fn push(&mut self, event: SharedEvent)
Push an event into the buffer.
This eagerly extracts the timestamp and clears any cached columns to maintain consistency.
Sourcepub fn drain_front(&mut self, count: usize) -> Vec<SharedEvent> ⓘ
pub fn drain_front(&mut self, count: usize) -> Vec<SharedEvent> ⓘ
Drain the first count events from the buffer.
Returns the drained events as a Vec<SharedEvent>.
Clears all cached columns since indices shift.
Sourcepub fn take_all(&mut self) -> Vec<SharedEvent> ⓘ
pub fn take_all(&mut self) -> Vec<SharedEvent> ⓘ
Take all events from the buffer, leaving it empty.
Returns the events as a Vec<SharedEvent>.
Sourcepub fn events(&self) -> &[SharedEvent] ⓘ
pub fn events(&self) -> &[SharedEvent] ⓘ
Get the events as a slice.
Sourcepub fn timestamps(&self) -> &[i64]
pub fn timestamps(&self) -> &[i64]
Get the timestamps as a slice (milliseconds since epoch).
Sourcepub fn ensure_float_column(&mut self, field: &str) -> &[f64]
pub fn ensure_float_column(&mut self, field: &str) -> &[f64]
Ensure a Float64 column exists for the given field.
If the column is already cached, returns the cached slice. Otherwise, extracts the field from all events and caches it.
Missing values are stored as f64::NAN.
Sourcepub fn ensure_int_column(&mut self, field: &str) -> &[i64]
pub fn ensure_int_column(&mut self, field: &str) -> &[i64]
Ensure an Int64 column exists for the given field.
If the column is already cached, returns the cached slice. Otherwise, extracts the field from all events and caches it.
Missing values are stored as i64::MIN.
Sourcepub fn ensure_string_column(&mut self, field: &str) -> &[Option<Arc<str>>]
pub fn ensure_string_column(&mut self, field: &str) -> &[Option<Arc<str>>]
Ensure a String column exists for the given field.
If the column is already cached, returns the cached slice. Otherwise, extracts the field from all events and caches it.
Sourcepub fn has_column(&self, field: &str) -> bool
pub fn has_column(&self, field: &str) -> bool
Check if a column is already cached.
Sourcepub fn get_column(&self, field: &str) -> Option<&Column>
pub fn get_column(&self, field: &str) -> Option<&Column>
Get the cached column if it exists.
Sourcepub fn checkpoint(&self) -> ColumnarCheckpoint
pub fn checkpoint(&self) -> ColumnarCheckpoint
Create a checkpoint of the buffer for persistence.
Note: Columns are NOT checkpointed - they are lazily re-extracted on restore.
Sourcepub fn restore(&mut self, cp: &ColumnarCheckpoint)
pub fn restore(&mut self, cp: &ColumnarCheckpoint)
Restore buffer state from a checkpoint.
Sourcepub fn from_events(events: Vec<SharedEvent>) -> Self
pub fn from_events(events: Vec<SharedEvent>) -> Self
Create from a Vec of SharedEvents.
Trait Implementations§
Source§impl Debug for ColumnarBuffer
impl Debug for ColumnarBuffer
Auto Trait Implementations§
impl Freeze for ColumnarBuffer
impl RefUnwindSafe for ColumnarBuffer
impl Send for ColumnarBuffer
impl Sync for ColumnarBuffer
impl Unpin for ColumnarBuffer
impl UnsafeUnpin for ColumnarBuffer
impl UnwindSafe for ColumnarBuffer
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> 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