Skip to content

Commit d786229

Browse files
authored
Merge pull request ostreedev#668 from cgwalters/pub-layerstate
store: Add a public accessor for layer
2 parents f243445 + abb125a commit d786229

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/src/container/store.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,23 @@ pub enum PrepareResult {
192192
/// A container image layer with associated downloaded-or-not state.
193193
#[derive(Debug)]
194194
pub struct ManifestLayerState {
195+
/// The underlying layer descriptor.
195196
pub(crate) layer: oci_image::Descriptor,
197+
// TODO semver: Make this readonly via an accessor
196198
/// The ostree ref name for this layer.
197199
pub ostree_ref: String,
200+
// TODO semver: Make this readonly via an accessor
198201
/// The ostree commit that caches this layer, if present.
199202
pub commit: Option<String>,
200203
}
201204

205+
impl ManifestLayerState {
206+
/// Return the layer descriptor.
207+
pub fn layer(&self) -> &oci_image::Descriptor {
208+
&self.layer
209+
}
210+
}
211+
202212
/// Information about which layers need to be downloaded.
203213
#[derive(Debug)]
204214
pub struct PreparedImport {
@@ -274,7 +284,7 @@ impl PreparedImport {
274284
if v.commit.is_some() {
275285
(stored + 1, to_fetch, sz)
276286
} else {
277-
(stored, to_fetch + 1, sz + v.layer.size())
287+
(stored, to_fetch + 1, sz + v.layer().size())
278288
}
279289
});
280290
(to_fetch > 0).then(|| {

0 commit comments

Comments
 (0)