Skip to main content

Reader

Struct Reader 

Source
pub struct Reader<'a> { /* private fields */ }
Expand description

Zero-copy reader for a .nxb buffer; supports row, columnar, and PAX layouts.

When opened with Self::with_options, prefetch state is protected by internal mutexes so the reader remains Send + Sync.

Implementations§

Source§

impl<'a> Reader<'a>

Source

pub fn new(data: &'a [u8]) -> Result<Self>

Validate the file header, detect layout, and build the schema index.

Source

pub fn with_options(data: &'a [u8], options: OpenOptions) -> Result<Self>

Open with prefetch options (row-layout viewport cache; phase 1+2).

Source

pub fn warmup(&self)

Wait for in-progress eager / background prefetch (§8).

Source

pub fn pause_prefetch(&self)

Stop scheduling speculative and eager prefetch (§8.1).

Source

pub fn resume_prefetch(&self)

Resume speculative prefetch after Self::pause_prefetch.

Source

pub fn prefetch_column(&self, key: &str) -> Result<()>

Prefetch a single column buffer (columnar layout only; §7.4).

Source

pub fn prefetch_viewport( &self, start_index: usize, end_index: usize, ) -> Result<()>

Prefetch pages covering records [start_index, end_index] (row layout only).

Source

pub fn cache_stats(&self) -> CacheStats

Page-cache statistics. Row prefetch counters are zero when opened via Self::new; columnar readers may still report CacheStats::column_fetches_issued.

Source

pub fn layout(&self) -> Layout

Row, columnar, or PAX layout.

Source

pub fn col_sum_f64(&self, key: &str) -> Option<f64>

Sum key as f64 across all records (uses column buffers when columnar/PAX).

Source

pub fn col_buffer(&self, key: &str) -> Option<&[u8]>

Zero-copy slice of a column’s dense numeric value buffer (columnar only).

Source

pub fn col_var_buffer(&self, key: &str) -> Result<VarColumnView<'_>>

Zero-copy string/binary column (offsets + values); columnar only.

Source

pub fn col_field_var_parts(&self, slot: usize) -> Result<(&[u8], &[u8], &[u8])>

Variable-length column parts (null bitmap, u32 offsets, values) for columnar layout.

Source

pub fn record_count(&self) -> usize

Number of top-level records in the file.

Source

pub fn keys(&self) -> &[String]

Schema key names.

Source

pub fn key_sigils(&self) -> &[u8]

Schema sigil bytes, parallel to keys().

Source

pub fn slot(&self, key: &str) -> Option<usize>

Resolve a key name to its slot index. O(1) via HashMap.

Source

pub fn record(&self, i: usize) -> Option<Record<'a, '_>>

Access a single record by zero-based index. O(1) via tail-index.

Source

pub fn all(&'a self) -> Records<'a, 'a, AlwaysTrue>

Return an iterator over all records.

Source

pub fn where_pred<P: Predicate>(&'a self, pred: P) -> Records<'a, 'a, P>

Return a lazy iterator over records matching pred.

Auto Trait Implementations§

§

impl<'a> !Freeze for Reader<'a>

§

impl<'a> RefUnwindSafe for Reader<'a>

§

impl<'a> Send for Reader<'a>

§

impl<'a> Sync for Reader<'a>

§

impl<'a> Unpin for Reader<'a>

§

impl<'a> UnsafeUnpin for Reader<'a>

§

impl<'a> UnwindSafe for Reader<'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, 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.