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>
impl<'a> Reader<'a>
Sourcepub fn new(data: &'a [u8]) -> Result<Self>
pub fn new(data: &'a [u8]) -> Result<Self>
Validate the file header, detect layout, and build the schema index.
Sourcepub fn with_options(data: &'a [u8], options: OpenOptions) -> Result<Self>
pub fn with_options(data: &'a [u8], options: OpenOptions) -> Result<Self>
Open with prefetch options (row-layout viewport cache; phase 1+2).
Sourcepub fn pause_prefetch(&self)
pub fn pause_prefetch(&self)
Stop scheduling speculative and eager prefetch (§8.1).
Sourcepub fn resume_prefetch(&self)
pub fn resume_prefetch(&self)
Resume speculative prefetch after Self::pause_prefetch.
Sourcepub fn prefetch_column(&self, key: &str) -> Result<()>
pub fn prefetch_column(&self, key: &str) -> Result<()>
Prefetch a single column buffer (columnar layout only; §7.4).
Sourcepub fn prefetch_viewport(
&self,
start_index: usize,
end_index: usize,
) -> Result<()>
pub fn prefetch_viewport( &self, start_index: usize, end_index: usize, ) -> Result<()>
Prefetch pages covering records [start_index, end_index] (row layout only).
Sourcepub fn cache_stats(&self) -> CacheStats
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.
Sourcepub fn col_sum_f64(&self, key: &str) -> Option<f64>
pub fn col_sum_f64(&self, key: &str) -> Option<f64>
Sum key as f64 across all records (uses column buffers when columnar/PAX).
Sourcepub fn col_buffer(&self, key: &str) -> Option<&[u8]>
pub fn col_buffer(&self, key: &str) -> Option<&[u8]>
Zero-copy slice of a column’s dense numeric value buffer (columnar only).
Sourcepub fn col_var_buffer(&self, key: &str) -> Result<VarColumnView<'_>>
pub fn col_var_buffer(&self, key: &str) -> Result<VarColumnView<'_>>
Zero-copy string/binary column (offsets + values); columnar only.
Sourcepub fn col_field_var_parts(&self, slot: usize) -> Result<(&[u8], &[u8], &[u8])>
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.
Sourcepub fn record_count(&self) -> usize
pub fn record_count(&self) -> usize
Number of top-level records in the file.
Sourcepub fn key_sigils(&self) -> &[u8] ⓘ
pub fn key_sigils(&self) -> &[u8] ⓘ
Schema sigil bytes, parallel to keys().
Sourcepub fn slot(&self, key: &str) -> Option<usize>
pub fn slot(&self, key: &str) -> Option<usize>
Resolve a key name to its slot index. O(1) via HashMap.
Sourcepub fn record(&self, i: usize) -> Option<Record<'a, '_>>
pub fn record(&self, i: usize) -> Option<Record<'a, '_>>
Access a single record by zero-based index. O(1) via tail-index.
Sourcepub fn all(&'a self) -> Records<'a, 'a, AlwaysTrue> ⓘ
pub fn all(&'a self) -> Records<'a, 'a, AlwaysTrue> ⓘ
Return an iterator over all records.
Sourcepub fn where_pred<P: Predicate>(&'a self, pred: P) -> Records<'a, 'a, P> ⓘ
pub fn where_pred<P: Predicate>(&'a self, pred: P) -> Records<'a, 'a, P> ⓘ
Return a lazy iterator over records matching pred.