ferro_oci_server/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2//! `ferro-oci-server`
3//!
4//! OCI Distribution Spec v1.1 (`opencontainers/distribution-spec`) and
5//! Docker Registry HTTP API v2 (`docker/distribution`) for FerroRepo.
6//!
7//! Phase 1 scope (wired in this crate):
8//!
9//! - `GET /v2/` version check and auth challenge (spec §3.2);
10//! - `GET /v2/_catalog` repository catalog with `n`/`last` pagination
11//! (spec §3.5);
12//! - `GET /v2/{name}/tags/list` tag listing with pagination (spec §3.6);
13//! - `GET|HEAD|DELETE /v2/{name}/blobs/{digest}` (spec §3.2 / §4.9);
14//! - `POST|PATCH|PUT /v2/{name}/blobs/uploads/{uuid?}` — monolithic
15//! and chunked uploads (spec §4.3–§4.8);
16//! - `GET|HEAD|PUT|DELETE /v2/{name}/manifests/{reference}` (spec
17//! §3.2 / §4.4 / §4.9);
18//! - `GET /v2/{name}/referrers/{digest}` referrers API (spec §3.3).
19//!
20//! The Phase 1 exit gate is 100 % pass on the
21//! `opencontainers/distribution-spec` conformance suite and interop
22//! with `docker`, `podman`, `crane`, `skopeo`, and `nerdctl`.
23
24pub mod error;
25pub mod handlers;
26pub mod manifest;
27pub mod media_types;
28pub mod reference;
29pub mod registry;
30pub mod router;
31pub mod upload;
32
33pub use error::{OciError, OciErrorBody, OciErrorCode, OciErrorInfo, OciResult};
34pub use manifest::{Descriptor, ImageIndex, ImageManifest, empty_image_index};
35pub use media_types::{ManifestKind, classify_manifest_media_type};
36pub use reference::{MAX_NAME_LENGTH, MAX_TAG_LENGTH, Reference, validate_name};
37pub use registry::{InMemoryRegistryMeta, ReferrerDescriptor, RegistryMeta};
38pub use router::{AppState, router};
39pub use upload::{ContentRange, UploadState};
40
41/// Crate name, exposed for diagnostics and `/metrics` labelling.
42pub const CRATE_NAME: &str = "ferro-oci-server";
43
44#[cfg(test)]
45mod tests {
46 use super::CRATE_NAME;
47
48 #[test]
49 fn crate_name_is_stable() {
50 assert_eq!(CRATE_NAME, "ferro-oci-server");
51 }
52}