Struct mz_persist::indexed::columnar::ColumnarRecordsBuilder
source · pub struct ColumnarRecordsBuilder {
len: usize,
key_data: BinaryBuilder,
val_data: BinaryBuilder,
timestamps: Vec<i64>,
diffs: Vec<i64>,
}
Expand description
An abstraction to incrementally add ((Key, Value), Time, i64) records in a columnar representation, and eventually get back a ColumnarRecords.
Fields§
§len: usize
§key_data: BinaryBuilder
§val_data: BinaryBuilder
§timestamps: Vec<i64>
§diffs: Vec<i64>
Implementations§
source§impl ColumnarRecordsBuilder
impl ColumnarRecordsBuilder
sourcepub fn with_capacity(items: usize, key_bytes: usize, val_bytes: usize) -> Self
pub fn with_capacity(items: usize, key_bytes: usize, val_bytes: usize) -> Self
Reserve space for the given number of items with the given sizes in bytes. If they end up being too small, the underlying buffers will be resized as usual.
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 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 total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
The current size of the columnar records data, useful for bounding batches at a target size.
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 Freeze for ColumnarRecordsBuilder
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
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.