mod registry

module registry

Fetch writes a dump. SAT and tests only read dumps.

A registry name hits Warehouse / CRAN / crates.io once and materializes the JSON (and sdist, when present) under ingest/<format>/. Replaying --source on that dump is offline.

Functions

fn is_registry_name(source: &Path) -> bool

True when --source is a registry name, not a dump file.

fn materialize_cargo(name: &str, client: &dyn RegistryClient, crates_base: &str, ingest_root: &Path) -> Result<MaterializedIngest, RegistryError>

Write a crates.io JSON dump under ingest_root/cargo/.

fn materialize_cran(name: &str, client: &dyn RegistryClient, crandb_base: &str, ingest_root: &Path) -> Result<MaterializedIngest, RegistryError>

Write a CRAN JSON dump under ingest_root/cran/.

fn materialize_pypi(name: &str, client: &dyn RegistryClient, warehouse_base: &str, ingest_root: &Path) -> Result<MaterializedIngest, RegistryError>

Write Warehouse JSON (and sdist, when listed) under ingest_root/pypi/.

fn materialize_registry_name(name: &str, format: ForeignFormat, client: &dyn RegistryClient, ingest_root: &Path) -> Result<MaterializedIngest, RegistryError>

Fetch a registry name into ingest_root and return the dump path.

fn pypi_json_url(base: &str, name: &str) -> String

Warehouse JSON URL for name, at version when one is pinned.

fn pypi_release_json_url(base: &str, name: &str, version: &str) -> String

Warehouse JSON URL for one release.

fn split_name_and_version(source: &str) -> (&str, Option<&str>)

A registry name, and the version it pins when it pins one.

tqdm==4.67.1 asks for the release a site actually carries rather than whatever is newest today, which is what regenerating an existing recipe needs, and what makes the same command produce the same recipe tomorrow.

Traits

trait RegistryClient

HTTP GET used by name-mode ingest. Tests inject a map; the CLI uses ureq.

Functions

fn get(&self, url: &str) -> Result<Vec<u8>, RegistryError>

Fetch url as bytes.

Enums

enum RegistryError

Why a name-mode fetch failed.

Missing(String)

The test map (or the live host) has no body for this URL.

Fetch(String)

The live GET failed.

Parse(String)

The dump could not be parsed enough to name the file.

Io(PathBuf, std::io::Error)

Writing the dump or sdist failed.

Structs and Unions

struct MapClient

In-memory client. cargo test never leaves this map.

pages: BTreeMap<String, Vec<u8>>

Exact URL to body.

Traits implemented

impl RegistryClient for MapClient
struct MaterializedIngest

Paths written by a name-mode fetch.

dump: PathBuf

Frozen registry document SAT will parse.

source_tree: Option<PathBuf>

Extracted sdist/crate tree, when a source archive was fetched.

struct UreqClient

Live HTTPS client. Not used by the default test gate.

Traits implemented

impl RegistryClient for UreqClient