pub struct FttsqReader { /* private fields */ }Expand description
A parsed, validated .fttsq directory over a buffer the reader does not own.
Implementations§
Source§impl FttsqReader
impl FttsqReader
Sourcepub fn open(bytes: &[u8]) -> Result<Self, FttsqError>
pub fn open(bytes: &[u8]) -> Result<Self, FttsqError>
Parses and fully validates an artifact, including every section digest.
Digest verification is not optional here. A reader that can be asked to skip it grows a caller that always skips it, and then corruption surfaces as audio rather than as an error.
§Errors
Returns a named FttsqError for any structural, range, or integrity violation.
Sourcepub fn parse_directory(bytes: &[u8]) -> Result<Self, FttsqError>
pub fn parse_directory(bytes: &[u8]) -> Result<Self, FttsqError>
Parses and structurally validates without computing digests.
For inspection tooling (ftts inspect) over an artifact whose bytes are not all present —
listing a remote artifact’s tensors, say. Never use this to load weights: it does not prove
the payload is intact.
§Errors
Returns a named FttsqError for any structural or range violation.
Sourcepub fn verify_digests(&self, bytes: &[u8]) -> Result<(), FttsqError>
pub fn verify_digests(&self, bytes: &[u8]) -> Result<(), FttsqError>
Recomputes and checks every section digest against bytes.
§Errors
Returns FttsqError::DigestMismatch naming the first corrupt section.
Sourcepub const fn format_version(&self) -> u32
pub const fn format_version(&self) -> u32
The format version the artifact declares.
Sourcepub fn model_family(&self) -> &str
pub fn model_family(&self) -> &str
The model family the artifact was built from.
Sourcepub fn source_sha256(&self) -> &str
pub fn source_sha256(&self) -> &str
SHA-256 of the upstream checkpoint this artifact was converted from.
Sourcepub fn license_notice(&self) -> &str
pub fn license_notice(&self) -> &str
The Apache-2.0 §4 attribution notice. Guaranteed non-empty.
Sourcepub const fn model_config(&self) -> &Value
pub const fn model_config(&self) -> &Value
The frozen copy of the upstream model config.
Sourcepub const fn quantization_manifest(&self) -> &Value
pub const fn quantization_manifest(&self) -> &Value
The per-tensor quantization policy actually applied, which the license notice references.
Sourcepub fn sections(&self) -> &[SectionEntry]
pub fn sections(&self) -> &[SectionEntry]
Every declared section, in declaration order.
Sourcepub fn tensors(&self) -> &[TensorEntry]
pub fn tensors(&self) -> &[TensorEntry]
Every declared tensor, in declaration order.
Sourcepub fn section(&self, name: &str) -> Option<&SectionEntry>
pub fn section(&self, name: &str) -> Option<&SectionEntry>
Looks a section up by name.
Sourcepub fn tensor(&self, name: &str) -> Option<&TensorEntry>
pub fn tensor(&self, name: &str) -> Option<&TensorEntry>
Looks a tensor up by name.
Sourcepub fn sections_in_class(&self, class: AccessClass) -> Vec<&SectionEntry>
pub fn sections_in_class(&self, class: AccessClass) -> Vec<&SectionEntry>
Sections belonging to one access class.
Sourcepub fn tensor_bytes<'a>(
&self,
name: &str,
bytes: &'a [u8],
) -> Result<&'a [u8], FttsqError>
pub fn tensor_bytes<'a>( &self, name: &str, bytes: &'a [u8], ) -> Result<&'a [u8], FttsqError>
The byte span of one tensor within bytes.
§Errors
Returns FttsqError::UnknownSection when the tensor’s section is missing, or
FttsqError::RangeOutOfBounds when the resolved span leaves the buffer.
Sourcepub fn page_in_plan(&self) -> Vec<(&SectionEntry, PagePolicy)>
pub fn page_in_plan(&self) -> Vec<(&SectionEntry, PagePolicy)>
The page-in plan: every section paired with its policy, in the order to apply them.
Ordered PagePolicy::Resident first. Prefetch order matters under memory pressure — the
section that gets its MADV_WILLNEED in last is the one most likely to find the page cache
already full, and that must never be the microdecoder pack.
Within the resident group, smaller sections come first: the ~110 MB microdecoder pack lands ahead of the ~440 MB talker, so the reread-15×-per-frame working set wins the race for cache it would otherwise lose to a body read once per frame.
Sourcepub fn verify_census(
&self,
manifest: &ArtifactManifest,
) -> Result<(), Box<ArtifactCensus>>
pub fn verify_census( &self, manifest: &ArtifactManifest, ) -> Result<(), Box<ArtifactCensus>>
Audits the artifact’s tensor directory against an expected inventory.
§Errors
Returns the itemized ArtifactCensus when anything is missing, extra, or mis-declared.
Trait Implementations§
Source§impl Clone for FttsqReader
impl Clone for FttsqReader
Source§fn clone(&self) -> FttsqReader
fn clone(&self) -> FttsqReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more