pub struct SegmentReader { /* private fields */ }Expand description
Validated read-only memory mapping with lazy region checksum verification.
Implementations§
Source§impl SegmentReader
impl SegmentReader
Sourcepub fn open(
vfs: &dyn Vfs,
path: &Path,
expected_id: SegmentId,
) -> Result<Self, SegmentError>
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.
Sourcepub const fn meta(&self) -> &SegmentMeta
pub const fn meta(&self) -> &SegmentMeta
Returns immutable manifest-visible metadata decoded from the header.
Sourcepub const fn header_length(&self) -> usize
pub const fn header_length(&self) -> usize
Returns exact header bytes touched by an O(manifest) open.
Sourcepub fn directory(&self) -> &[RegionEntry]
pub fn directory(&self) -> &[RegionEntry]
Returns the validated region directory, including unknown skippable kinds.
Sourcepub fn unknown_region_ids(&self) -> Vec<u16>
pub fn unknown_region_ids(&self) -> Vec<u16>
Returns unknown region ids without treating them as corruption.
Sourcepub fn region(&self, kind: RegionKind) -> Result<&[u8], SegmentError>
pub fn region(&self, kind: RegionKind) -> Result<&[u8], SegmentError>
Validates a complete region and returns its original mmap-backed bytes.
Sourcepub fn region_chunk(
&self,
kind: RegionKind,
chunk_index: u32,
) -> Result<&[u8], SegmentError>
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.
Sourcepub fn bit4_codes(&self) -> Result<&[u8], SegmentError>
pub fn bit4_codes(&self) -> Result<&[u8], SegmentError>
Returns packed Bit4 code bytes exactly as passed to the batch kernel.
Sourcepub fn f32_codes(&self) -> Result<&[f32], SegmentError>
pub fn f32_codes(&self) -> Result<&[f32], SegmentError>
Casts validated full-precision code rows directly from the mapping.
Sourcepub fn int8_codes(&self) -> Result<&[i8], SegmentError>
pub fn int8_codes(&self) -> Result<&[i8], SegmentError>
Casts signed-byte vector codes directly from the validated mmap region.
Sourcepub fn bit4_factors(&self) -> Result<&[Bit4Factors], SegmentError>
pub fn bit4_factors(&self) -> Result<&[Bit4Factors], SegmentError>
Casts the validated factor region directly to permanent Bit4 records.
Sourcepub fn int8_factors(&self) -> Result<&[Int8Factors], SegmentError>
pub fn int8_factors(&self) -> Result<&[Int8Factors], SegmentError>
Casts a validated Int8 factor region directly to permanent records.
Sourcepub fn rescore_f32(&self) -> Result<&[f32], SegmentError>
pub fn rescore_f32(&self) -> Result<&[f32], SegmentError>
Casts validated f32 exact-rescore rows directly from the mmap.
Sourcepub fn columns(&self) -> Result<ColumnStore, SegmentError>
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.
Sourcepub fn postings(&self) -> Result<Option<SealedSegment>, SegmentError>
pub fn postings(&self) -> Result<Option<SealedSegment>, SegmentError>
Decodes the optional whole-segment lexical region.
Sourcepub fn alive(&self) -> Result<AliveSet, SegmentError>
pub fn alive(&self) -> Result<AliveSet, SegmentError>
Decodes the checksummed alive/tombstone region.
Sourcepub fn document_version(
&self,
row: usize,
) -> Result<Option<DocumentVersion>, SegmentError>
pub fn document_version( &self, row: usize, ) -> Result<Option<DocumentVersion>, SegmentError>
Decodes one optional sealed-row document identity directly from the mapping.
Sourcepub fn row_for_document_version(
&self,
version: DocumentVersion,
) -> Result<Option<usize>, SegmentError>
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.
Sourcepub fn stored_metadata(
&self,
) -> Result<Option<StoredMetadataRows<'_>>, SegmentError>
pub fn stored_metadata( &self, ) -> Result<Option<StoredMetadataRows<'_>>, SegmentError>
Returns validated opaque metadata rows, or None for older segments.
Sourcepub fn stored_text(&self) -> Result<Option<StoredTextRows<'_>>, SegmentError>
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
impl SegmentReader
Sourcepub fn graph_node_blocks(&self) -> Result<GraphNodeBlocks<'_>, SegmentError>
pub fn graph_node_blocks(&self) -> Result<GraphNodeBlocks<'_>, SegmentError>
Returns the validated, mmap-backed fixed-stride graph node-block region.
Sourcepub fn validate_all(&self) -> Result<(), SegmentError>
pub fn validate_all(&self) -> Result<(), SegmentError>
Validates every region, alignment padding, and the whole-file trailer.