docker_image_pusher/image/mod.rs
1//! Docker image handling module
2//!
3//! This module provides types and logic for parsing, validating, and extracting metadata from Docker image tar packages.
4//! It exposes the main [`ImageParser`] for reading image manifests, configs, and layers.
5//!
6//! # Overview
7//!
8//! The module is primarily concerned with interpreting the contents of Docker image tarballs,
9//! which include the image manifest, configuration data, and layer archives.
10//! It provides structures and implementations for accessing and manipulating this data.
11//!
12//! # Usage
13//!
14//! To use this module, import it and call the [`ImageParser::parse`] method with a tarball reader.
15//! This will return an [`ImageInfo`] structure containing metadata about the image,
16//! as well as methods for accessing the individual layers and configuration.
17//!
18//! # Examples
19//!
20//! Basic usage involves creating an `ImageParser` and parsing a tar file:
21//!
22//! ```no_run
23//! use std::path::Path;
24//! use docker_image_pusher::image::ImageParser;
25//! use docker_image_pusher::logging::Logger;
26//!
27//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
28//! let output = Logger::new(false);
29//! let mut parser = ImageParser::new(output);
30//! let image_info = parser.parse_tar_file(Path::new("path/to/image.tar")).await?;
31//! // Now you can access image metadata and layers
32//! # Ok(())
33//! # }
34//! ```
35//!
36//! See the individual struct and enum documentation for more details on the available methods and fields.
37//!
38//! # Processing Docker Images
39//!
40//! This module also includes functionality for processing Docker images,
41//! such as extracting and handling image manifests and layer data.
42
43// This file defines the module for handling Docker images, including parsing and processing image tar packages.
44
45pub mod cache;
46pub mod digest;
47pub mod image_manager;
48pub mod manifest;
49pub mod parser;
50
51// Specific exports to avoid ambiguity
52pub use cache::Cache;
53pub use digest::DigestUtils;
54pub use image_manager::ImageManager;
55pub use manifest::{get_layers, is_gzipped, parse_manifest};
56pub use parser::{ImageInfo, ImageParser, LayerInfo};
57
58// Re-export ImageConfig only from parser to avoid ambiguity
59pub use parser::ImageConfig;