Struct mz_persist::indexed::columnar::ColumnarRecordsBuilder
source · pub struct ColumnarRecordsBuilder { /* private fields */ }
Expand description
An abstraction to incrementally add ((Key, Value), Time, i64) records in a columnar representation, and eventually get back a ColumnarRecords.
Implementations§
source§impl ColumnarRecordsBuilder
impl ColumnarRecordsBuilder
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of (potentially duplicated) ((Key, Val), Time, i64) records stored in Self.
sourcepub fn reserve(
&mut self,
additional: usize,
key_size_guess: usize,
val_size_guess: usize
)
pub fn reserve( &mut self, additional: usize, key_size_guess: usize, val_size_guess: usize )
Reserve space for additional
more records, based on key_size_guess
and
val_size_guess
.
The guesses for key and val sizes are best effort, and if they end up being too small, the underlying buffers will be resized.
sourcepub fn reserve_exact(
&mut self,
additional: usize,
key_bytes: usize,
val_bytes: usize
)
pub fn reserve_exact( &mut self, additional: usize, key_bytes: usize, val_bytes: usize )
Reserve space for additional
more records, with exact sizes for the key and value data.
sourcepub fn can_fit(&self, key: &[u8], val: &[u8], limit: usize) -> bool
pub fn can_fit(&self, key: &[u8], val: &[u8], limit: usize) -> bool
Returns if the given key_offsets+key_data or val_offsets+val_data fits in the limits imposed by ColumnarRecords.
Note that limit is always KEY_VAL_DATA_MAX_LEN in production. It’s only override-able here for testing.
sourcepub fn push(&mut self, record: ((&[u8], &[u8]), [u8; 8], [u8; 8])) -> bool
pub fn push(&mut self, record: ((&[u8], &[u8]), [u8; 8], [u8; 8])) -> bool
Add a record to Self.
Returns whether the record was successfully added. A record will not a added if it exceeds the size limitations of ColumnarBatch. This method is atomic, if it fails, no partial data will have been added.
sourcepub fn finish(self, metrics: &ColumnarMetrics) -> ColumnarRecords
pub fn finish(self, metrics: &ColumnarMetrics) -> ColumnarRecords
Finalize constructing a ColumnarRecords.
sourcepub fn columnar_record_size(
key_bytes_len: usize,
value_bytes_len: usize
) -> usize
pub fn columnar_record_size( key_bytes_len: usize, value_bytes_len: usize ) -> usize
Size of an update record as stored in the columnar representation
Trait Implementations§
source§impl Debug for ColumnarRecordsBuilder
impl Debug for ColumnarRecordsBuilder
Auto Trait Implementations§
impl RefUnwindSafe for ColumnarRecordsBuilder
impl Send for ColumnarRecordsBuilder
impl Sync for ColumnarRecordsBuilder
impl Unpin for ColumnarRecordsBuilder
impl UnwindSafe for ColumnarRecordsBuilder
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.