From abb125a39f0ae17400c2b6e99786e7095f5d3a63 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 29 Sep 2024 17:38:36 -0400 Subject: [PATCH] store: Add a public accessor for layer rpm-ostree at least needs this. Signed-off-by: Colin Walters --- lib/src/container/store.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/src/container/store.rs b/lib/src/container/store.rs index 6dc15713..23c718d5 100644 --- a/lib/src/container/store.rs +++ b/lib/src/container/store.rs @@ -192,13 +192,23 @@ pub enum PrepareResult { /// A container image layer with associated downloaded-or-not state. #[derive(Debug)] pub struct ManifestLayerState { + /// The underlying layer descriptor. pub(crate) layer: oci_image::Descriptor, + // TODO semver: Make this readonly via an accessor /// The ostree ref name for this layer. pub ostree_ref: String, + // TODO semver: Make this readonly via an accessor /// The ostree commit that caches this layer, if present. pub commit: Option, } +impl ManifestLayerState { + /// Return the layer descriptor. + pub fn layer(&self) -> &oci_image::Descriptor { + &self.layer + } +} + /// Information about which layers need to be downloaded. #[derive(Debug)] pub struct PreparedImport { @@ -274,7 +284,7 @@ impl PreparedImport { if v.commit.is_some() { (stored + 1, to_fetch, sz) } else { - (stored, to_fetch + 1, sz + v.layer.size()) + (stored, to_fetch + 1, sz + v.layer().size()) } }); (to_fetch > 0).then(|| {