pub struct FttsqStreamPlan { /* private fields */ }Expand description
Metadata and fixed section lengths for a bounded .fttsq conversion.
A converter learns every tensor’s shape, storage policy, section, and final byte length from the validated input manifest before it starts payload conversion. That lets this plan reserve the directory first, then stream one section at a time into a caller-owned seekable temporary file. The writer never retains a payload section, and does not create, rename, or remove files: the caller owns the atomic-temp-file policy around it.
Implementations§
Source§impl FttsqStreamPlan
impl FttsqStreamPlan
Sourcepub fn new(
model_family: impl Into<String>,
source_sha256: impl Into<String>,
) -> Self
pub fn new( model_family: impl Into<String>, source_sha256: impl Into<String>, ) -> Self
Starts a bounded conversion plan for one model family and source checkpoint.
Sourcepub fn license_notice(self, notice: impl Into<String>) -> Self
pub fn license_notice(self, notice: impl Into<String>) -> Self
Sets the required Apache-2.0 §4 attribution notice.
Sourcepub fn model_config(self, config: Value) -> Self
pub fn model_config(self, config: Value) -> Self
Attaches the frozen upstream model configuration.
Sourcepub fn quantization_manifest(self, manifest: Value) -> Self
pub fn quantization_manifest(self, manifest: Value) -> Self
Attaches the policy used to quantize each tensor.
Sourcepub fn section(
self,
name: impl Into<String>,
access_class: AccessClass,
length: u64,
) -> Self
pub fn section( self, name: impl Into<String>, access_class: AccessClass, length: u64, ) -> Self
Declares a section’s final byte length before its bytes are streamed.
Sourcepub fn tensor(self, tensor: TensorEntry) -> Self
pub fn tensor(self, tensor: TensorEntry) -> Self
Declares a tensor located in one of the planned sections.
Sourcepub fn begin<W: Write + Seek>(
self,
writer: W,
) -> Result<FttsqStreamingWriter<W>, FttsqError>
pub fn begin<W: Write + Seek>( self, writer: W, ) -> Result<FttsqStreamingWriter<W>, FttsqError>
Writes the header and reserved directory into a caller-owned seekable stream.
Payload sections must subsequently be supplied in declaration order through
FttsqStreamingWriter::write_section. A caller that needs an atomic artifact should
provide its own same-filesystem temporary file, call FttsqStreamingWriter::finish,
sync it, and rename it only after this method has finalized the directory.
§Errors
Refuses malformed planned metadata before writing any bytes, and names I/O failures from the caller’s stream without assuming a path or filesystem policy.