cargo
/cargo/index/ Rust crates, over the sparse index cargo prefers
How it works
-
Each
.crateis checked against thecksumits line in the sparse index publishes, before the bytes are stored. -
cargo used to resolve dependencies by cloning one enormous index repository. The sparse protocol replaced that with ordinary HTTP lookups per crate, and that is what LibWorld speaks — so resolving a handful of crates fetches a handful of small files rather than the whole registry.
-
A .crate file is immutable: crates.io does not permit republishing a version. So a crate is cached permanently on first fetch.
-
Index files are revalidated, because a crate gains versions over time.
Things that have cost real time
Written down because they were paid for once already.
Splitting <name>-<version>.crate is not a split on the dash. The boundary is the first - that is followed by a digit, which is the only rule that gets both foo-bar-1.0.0 and foo-1.0.0-alpha right. Anything simpler mis-catalogues every crate with a dashed name, and does it quietly.