Skip to main content

RunWriter

Struct RunWriter 

Source
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>

Source

pub fn new( schema: &'a Schema, run_id: u128, epoch_created: Epoch, level: u8, ) -> Self

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.