Skip to main content

ferro_cargo_registry_server/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2//! `ferro-cargo-registry-server`
3//!
4//! Cargo registry protocol for FerroRepo — sparse-index + publish /
5//! yank / owners / download endpoints. The Git-index protocol is
6//! wired with a 501 stub in Phase 1; Cargo itself defaults to sparse
7//! since 1.68 (`CARGO_REGISTRIES_*_PROTOCOL=sparse`), so the stub is a
8//! no-op for the client flows we target.
9//!
10//! ## Spec references
11//!
12//! - Registry reference —
13//!   <https://doc.rust-lang.org/cargo/reference/registries.html>
14//! - Registry Web API —
15//!   <https://doc.rust-lang.org/cargo/reference/registry-web-api.html>
16//! - Index format —
17//!   <https://doc.rust-lang.org/cargo/reference/registries.html#index-format>
18//! - Publish pre-image layout (binary) —
19//!   registry-web-api.html#publish
20
21#![deny(missing_docs)]
22
23pub mod config;
24pub mod error;
25pub mod handlers;
26pub mod index;
27pub mod name;
28pub mod owners;
29pub mod publish;
30pub mod router;
31pub mod version;
32pub mod yank;
33
34pub use config::IndexConfig;
35pub use error::CargoError;
36pub use index::{IndexDep, IndexEntry, entry_from_manifest, parse_lines, render_lines};
37pub use name::{MAX_NAME_LEN, index_path, is_valid_name, validate_name};
38pub use owners::{Owner, OwnersMutationResponse, OwnersRequest, OwnersResponse};
39pub use publish::{PublishRequest, encode as encode_publish_body, parse as parse_publish_body};
40pub use router::{CargoState, CrateRecord, router};
41pub use version::is_valid_semver;
42pub use yank::YankResponse;
43
44/// Crate name, exposed for diagnostics and `/metrics` labelling.
45pub const CRATE_NAME: &str = "ferro-cargo-registry-server";
46
47#[cfg(test)]
48mod tests {
49    use super::CRATE_NAME;
50
51    #[test]
52    fn crate_name_is_stable() {
53        assert_eq!(CRATE_NAME, "ferro-cargo-registry-server");
54    }
55}