pub struct ZsyncAssembly { /* private fields */ }Implementations§
Source§impl ZsyncAssembly
impl ZsyncAssembly
pub fn new( control: ControlFile, output_path: &Path, ) -> Result<Self, AssemblyError>
pub fn with_base_url( control: ControlFile, output_path: &Path, base_url: Option<&str>, ) -> Result<Self, AssemblyError>
Sourcepub fn with_client(
control: ControlFile,
output_path: &Path,
base_url: Option<&str>,
http: HttpClient,
) -> Result<Self, AssemblyError>
pub fn with_client( control: ControlFile, output_path: &Path, base_url: Option<&str>, http: HttpClient, ) -> Result<Self, AssemblyError>
Assemble using a caller-supplied HTTP client.
The client carries the transport policy for every range request the assembly makes, so an embedder that needs its own TLS roots or that must refuse a redirect to plain HTTP can set it once here.
pub fn from_url( control_url: &str, output_path: &Path, ) -> Result<Self, AssemblyError>
Sourcepub fn from_url_with_client(
control_url: &str,
output_path: &Path,
http: HttpClient,
) -> Result<Self, AssemblyError>
pub fn from_url_with_client( control_url: &str, output_path: &Path, http: HttpClient, ) -> Result<Self, AssemblyError>
Fetch the control file and assemble, both using http.
The same client serves the control-file fetch and every subsequent range request, so one policy covers the whole transfer.
pub fn set_range_gap_threshold(&mut self, threshold: u64)
Sourcepub fn set_abort_flag(&mut self, flag: Arc<AtomicBool>)
pub fn set_abort_flag(&mut self, flag: Arc<AtomicBool>)
Sets a flag polled during the scan and download loops.
Once the caller raises it, the running operation stops at the next
chunk boundary and returns AssemblyError::Aborted, so a long
transfer can be cancelled without waiting for it to finish.
pub fn set_progress_callback<F>(&mut self, callback: F)
pub fn progress(&self) -> (u64, u64)
pub fn is_complete(&self) -> bool
pub fn block_stats(&self) -> (usize, usize)
pub fn submit_source_file( &mut self, path: &Path, ) -> Result<usize, AssemblyError>
pub fn submit_self_referential(&mut self) -> Result<usize, AssemblyError>
pub fn download_missing_blocks(&mut self) -> Result<usize, AssemblyError>
pub fn complete(self) -> Result<(), AssemblyError>
Trait Implementations§
Source§impl Drop for ZsyncAssembly
impl Drop for ZsyncAssembly
Source§fn drop(&mut self)
fn drop(&mut self)
Removes the temp file unless ZsyncAssembly::complete already renamed
it into place.
Every failure path would otherwise leave a partial .zsync-tmp beside
the output. Nothing resumes from it: a later run builds a fresh matcher
that cannot tell which of its blocks are already written.