Skip to main content

SegmentReader

Struct SegmentReader 

Source
pub struct SegmentReader { /* private fields */ }
Expand description

Validated read-only memory mapping with lazy region checksum verification.

Implementations§

Source§

impl SegmentReader

Source

pub fn open( vfs: &dyn Vfs, path: &Path, expected_id: SegmentId, ) -> Result<Self, SegmentError>

Memory-maps a segment and validates only its bounded header/directory.

Source

pub const fn meta(&self) -> &SegmentMeta

Returns immutable manifest-visible metadata decoded from the header.

Source

pub const fn header_length(&self) -> usize

Returns exact header bytes touched by an O(manifest) open.

Source

pub fn directory(&self) -> &[RegionEntry]

Returns the validated region directory, including unknown skippable kinds.

Source

pub fn unknown_region_ids(&self) -> Vec<u16>

Returns unknown region ids without treating them as corruption.

Source

pub fn region(&self, kind: RegionKind) -> Result<&[u8], SegmentError>

Validates a complete region and returns its original mmap-backed bytes.

Source

pub fn region_chunk( &self, kind: RegionKind, chunk_index: u32, ) -> Result<&[u8], SegmentError>

Validates one 64-KB chunk and returns only that mmap-backed chunk.

Source

pub fn bit4_codes(&self) -> Result<&[u8], SegmentError>

Returns packed Bit4 code bytes exactly as passed to the batch kernel.

Source

pub fn f32_codes(&self) -> Result<&[f32], SegmentError>

Casts validated full-precision code rows directly from the mapping.

Source

pub fn int8_codes(&self) -> Result<&[i8], SegmentError>

Casts signed-byte vector codes directly from the validated mmap region.

Source

pub fn bit4_factors(&self) -> Result<&[Bit4Factors], SegmentError>

Casts the validated factor region directly to permanent Bit4 records.

Source

pub fn int8_factors(&self) -> Result<&[Int8Factors], SegmentError>

Casts a validated Int8 factor region directly to permanent records.

Source

pub fn rescore_f32(&self) -> Result<&[f32], SegmentError>

Casts validated f32 exact-rescore rows directly from the mmap.

Source

pub fn columns(&self) -> Result<ColumnStore, SegmentError>

Decodes the checksummed metadata region into typed column arrays.

A reader from a published snapshot decodes against the collection schema, so columns added after this segment was sealed read as null.

Source

pub fn postings(&self) -> Result<Option<SealedSegment>, SegmentError>

Decodes the optional whole-segment lexical region.

Source

pub fn alive(&self) -> Result<AliveSet, SegmentError>

Decodes the checksummed alive/tombstone region.

Source

pub fn document_version( &self, row: usize, ) -> Result<Option<DocumentVersion>, SegmentError>

Decodes one optional sealed-row document identity directly from the mapping.

Source

pub fn row_for_document_version( &self, version: DocumentVersion, ) -> Result<Option<usize>, SegmentError>

Finds the sealed row that holds exactly version.

None means the segment predates document versions or holds no row with that exact document id and revision.

Source

pub fn stored_metadata( &self, ) -> Result<Option<StoredMetadataRows<'_>>, SegmentError>

Returns validated opaque metadata rows, or None for older segments.

Source

pub fn stored_text(&self) -> Result<Option<StoredTextRows<'_>>, SegmentError>

Returns validated optional UTF-8 source rows, or None for older segments.

Every call verifies the region checksum and walks every row offset.

Source§

impl SegmentReader

Source

pub fn graph_node_blocks(&self) -> Result<GraphNodeBlocks<'_>, SegmentError>

Returns the validated, mmap-backed fixed-stride graph node-block region.

Source

pub fn validate_all(&self) -> Result<(), SegmentError>

Validates every region, alignment padding, and the whole-file trailer.

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.