Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

container: Make ManifestDiff serializable #619

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/src/container/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use anyhow::anyhow;
use containers_image_proxy::oci_spec;
use ostree::glib;
use serde::Serialize;

use std::borrow::Cow;
use std::collections::HashMap;
Expand Down Expand Up @@ -295,27 +296,31 @@ impl std::fmt::Display for OstreeImageReference {
}

/// Represents the difference in layer/blob content between two OCI image manifests.
#[derive(Debug)]
#[derive(Debug, Serialize)]
pub struct ManifestDiff<'a> {
/// The source container image manifest.
#[serde(skip)]
pub from: &'a oci_spec::image::ImageManifest,
/// The target container image manifest.
#[serde(skip)]
pub to: &'a oci_spec::image::ImageManifest,
/// Layers which are present in the old image but not the new image.
#[serde(skip)]
pub removed: Vec<&'a oci_spec::image::Descriptor>,
/// Layers which are present in the new image but not the old image.
#[serde(skip)]
pub added: Vec<&'a oci_spec::image::Descriptor>,
/// Total number of packages
/// Total number of layers
pub total: u64,
/// Size of total number of packages.
/// Size of total number of layers.
pub total_size: u64,
/// Number of packages removed
/// Number of layers removed
pub n_removed: u64,
/// Size of the number of packages removed
/// Size of the number of layers removed
pub removed_size: u64,
/// Number of packages added
pub n_added: u64,
/// Size of the number of packages added
/// Size of the number of layers added
pub added_size: u64,
}

Expand Down
Loading