Skip to content

Commit 5362c9b

Browse files
committed
boundimage: Add some module docs
Signed-off-by: Colin Walters <[email protected]>
1 parent 347a293 commit 5362c9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/src/boundimage.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! # Implementation of "logically bound" container images
2+
//!
3+
//! This module implements the design in <https://github.com/containers/bootc/issues/128>
4+
//! for "logically bound" container images. These container images are
5+
//! pre-pulled (and in the future, pinned) before a new image root
6+
//! is considered ready.
7+
18
use crate::task::Task;
29
use anyhow::{Context, Result};
310
use camino::Utf8Path;
@@ -7,8 +14,11 @@ use fn_error_context::context;
714
use ostree_ext::ostree::Deployment;
815
use ostree_ext::sysroot::SysrootLock;
916

17+
/// The path in a root for bound images; this directory should only contain
18+
/// symbolic links to `.container` or `.image` files.
1019
const BOUND_IMAGE_DIR: &str = "usr/lib/bootc-experimental/bound-images.d";
1120

21+
/// Given a deployment, pull all container images it references.
1222
pub(crate) fn pull_bound_images(sysroot: &SysrootLock, deployment: &Deployment) -> Result<()> {
1323
let sysroot_fd = crate::utils::sysroot_fd(&sysroot);
1424
let sysroot_fd = Dir::reopen_dir(&sysroot_fd)?;
@@ -111,6 +121,11 @@ fn pull_images(_deployment_root: &Dir, bound_images: Vec<BoundImage>) -> Result<
111121
Ok(())
112122
}
113123

124+
/// A subset of data parsed from a `.image` or `.container` file with
125+
/// the minimal information necessary to fetch the image.
126+
///
127+
/// In the future this may be extended to include e.g. certificates or
128+
/// other pull options.
114129
#[derive(PartialEq, Eq)]
115130
struct BoundImage {
116131
image: String,
@@ -131,6 +146,10 @@ impl BoundImage {
131146
}
132147
}
133148

149+
/// Given a string, parse it in a way similar to how systemd would do it.
150+
/// The primary thing here is that we reject any "specifiers" such as `%a`
151+
/// etc. We do allow a quoted `%%` to appear in the string, which will
152+
/// result in a single unquoted `%`.
134153
fn parse_spec_value(value: &str) -> Result<String> {
135154
let mut it = value.chars();
136155
let mut ret = String::new();

0 commit comments

Comments
 (0)