pub struct RunWriter<'a> { /* private fields */ }Expand description
Builds and writes a sorted run from drained memtable rows.
rows must be sorted ascending by (row_id, epoch) (the memtable’s natural
drain order). System columns _row_id, _epoch, _deleted are always
emitted; each user column in schema is emitted, with Null for rows that
don’t set it.
Implementations§
Source§impl<'a> RunWriter<'a>
impl<'a> RunWriter<'a>
pub fn new( schema: &'a Schema, run_id: u128, epoch_created: Epoch, level: u8, ) -> Self
Sourcepub fn uniform_epoch(self, uniform: bool) -> Self
pub fn uniform_epoch(self, uniform: bool) -> Self
Mark this run as uniform-epoch: its stored _epoch column is a
placeholder and the real commit epoch is supplied at read time from the
manifest RunRef.epoch_created (see RUN_FLAG_UNIFORM_EPOCH). Used by
the large-transaction spill path, which writes the run before the commit
epoch is assigned.
Sourcepub fn with_encryption(
self,
kek: &'a Kek,
indexable_columns: Vec<(u16, u8)>,
) -> Self
pub fn with_encryption( self, kek: &'a Kek, indexable_columns: Vec<(u16, u8)>, ) -> Self
Encrypt this run’s pages with a fresh per-file DEK wrapped by kek.
indexable_columns are the ENCRYPTED_INDEXABLE (column_id, scheme)
pairs whose column keys are derived+wrapped into the descriptor.
Sourcepub fn with_zstd_level(self, level: i32) -> Self
pub fn with_zstd_level(self, level: i32) -> Self
Override the zstd level for this run’s pages (Phase 14.4). The bulk ingest path uses level 1; background compaction upgrades cold runs to 3.
Sourcepub fn with_lz4(self) -> Self
pub fn with_lz4(self) -> Self
Compress hot/mutable-run pages with LZ4 (Phase 15.3): 3–5× faster decode than zstd with ~10% worse ratio. The right default for runs that get scanned (bulk-loaded analytical runs).
Sourcepub fn with_plain(self) -> Self
pub fn with_plain(self) -> Self
Emit raw ALGO_PLAIN pages with no compression (Phase 14.4
bulk_load_fast): maximal encode throughput at the cost of ~3–4× size.
Sourcepub fn clean(self, clean: bool) -> Self
pub fn clean(self, clean: bool) -> Self
Mark this run as “clean” (one version per RowId, no tombstones, ascending
row_ids). Only set when the caller constructs the system columns so by
construction (typed bulk load of fresh, contiguous row_ids; compaction
output that has collapsed versions and dropped tombstones). Stamps
RUN_FLAG_CLEAN into the header so readers skip the MVCC pass.
Sourcepub fn with_native_endian(self) -> Self
pub fn with_native_endian(self) -> Self
Write fixed-width page payloads in little-endian (Phase 15.7): the decode
path becomes a memcpy on little-endian targets. Only effective on the
typed write_native path; no-op on big-endian writers (they keep the
portable BE layout, since “native” would not be LE there).
Sourcepub fn write_native(
self,
path: impl AsRef<Path>,
user_columns: &[(u16, NativeColumn)],
n: usize,
first_row_id: u64,
) -> Result<RunHeader>
pub fn write_native( self, path: impl AsRef<Path>, user_columns: &[(u16, NativeColumn)], n: usize, first_row_id: u64, ) -> Result<RunHeader>
Write a run straight from typed columns (no Value). user_columns are
the schema’s user columns as [NativeColumn]s; the system columns
(_row_id/_epoch/_deleted) are built from first_row_id..+n /
epoch_created / all-false. Sorted Int64 columns (always the system
_row_id, plus any sorted user Int64) use delta encoding unless
RunWriter::with_plain forces raw ALGO_PLAIN everywhere.
pub fn write(self, path: impl AsRef<Path>, rows: &[Row]) -> Result<RunHeader>
Auto Trait Implementations§
impl<'a> Freeze for RunWriter<'a>
impl<'a> RefUnwindSafe for RunWriter<'a>
impl<'a> Send for RunWriter<'a>
impl<'a> Sync for RunWriter<'a>
impl<'a> Unpin for RunWriter<'a>
impl<'a> UnsafeUnpin for RunWriter<'a>
impl<'a> UnwindSafe for RunWriter<'a>
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> 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