cargo::sources::registry

Module index

Source
Expand description

Management of the index of a registry source.

This module contains management of the index and various operations, such as actually parsing the index, looking for crates, etc. This is intended to be abstract over remote indices (downloaded via Git or HTTP) and local registry indices (which are all just present on the filesystem).

ยงHow the index works

Here is a simple flow when loading a Summary (metadata) from the index:

  1. A query is fired via RegistryIndex::query_inner.
  2. Tries loading all summaries via RegistryIndex::load_summaries, and under the hood calling Summaries::parse to parse an index file.
    1. If an on-disk index cache is present, loads it via Summaries::parse_cache.
    2. Otherwise goes to the slower path RegistryData::load to get the specific index file.
  3. A Summary is now ready in callback f in RegistryIndex::query_inner.

To learn the rationale behind this multi-layer index metadata loading, see the documentation of the on-disk index cache.

Modulesยง

  • cache ๐Ÿ”’
    A layer of on-disk index cache for performance.

Structsยง

Enumsยง

  • A parsed representation of a summary from the index. This is usually parsed from a line from a raw index file, or a JSON blob from on-disk index cache.
  • MaybeIndexSummary ๐Ÿ”’
    A lazily parsed IndexSummary.

Constantsยง

  • INDEX_V_MAX ๐Ÿ”’
    The maximum schema version of the v field in the index this version of cargo understands. See IndexPackage::v for the detail.

Functionsยง