Skip to content

Commit

Permalink
Merge pull request #668 from cgwalters/pub-layerstate
Browse files Browse the repository at this point in the history
store: Add a public accessor for layer
  • Loading branch information
HuijingHei authored Sep 30, 2024
2 parents f243445 + abb125a commit d786229
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/src/container/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

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 {
Expand Down Expand Up @@ -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(|| {
Expand Down

0 comments on commit d786229

Please sign in to comment.