1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Efficient partial file transfer over HTTP, compatible with zsync.
//!
//! A `.zsync` control file describes a target file as a list of block
//! checksums. A client that already holds similar data, such as an older
//! version of the same file, finds the blocks it has locally and downloads
//! only the rest with HTTP range requests. Nothing beyond a plain web server
//! that honours `Range` is needed on the serving side.
//!
//! [`ZsyncAssembly`] drives a whole transfer and is the place to start. The
//! modules beneath it are public for callers that need one piece on its own:
//! [`control`] reads and writes control files, [`matcher`] finds known
//! blocks in local data, [`http`] fetches ranges, and [`checksum`] and
//! [`rsum`] are the hashes the format is built on.
//!
//! ```no_run
//! use std::path::Path;
//! use zsync_rs::ZsyncAssembly;
//!
//! # fn main() -> Result<(), zsync_rs::AssemblyError> {
//! let mut assembly =
//! ZsyncAssembly::from_url("https://example.com/file.zsync", Path::new("file.bin"))?;
//!
//! assembly.submit_source_file(Path::new("old-file.bin"))?;
//! while assembly.download_missing_blocks()? > 0 {}
//!
//! // Fails if any block is still missing, then verifies the SHA-1.
//! assembly.complete()?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use BlockMatcher;