Skip to content

Commit

Permalink
boundimage: More struct definition to top
Browse files Browse the repository at this point in the history
I think it's generally best to have type definitions come before
the code that references them.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jul 19, 2024
1 parent 3357d2a commit 79ed0be
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/src/boundimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ use ostree_ext::sysroot::SysrootLock;
/// symbolic links to `.container` or `.image` files.
const BOUND_IMAGE_DIR: &str = "usr/lib/bootc-experimental/bound-images.d";

/// A subset of data parsed from a `.image` or `.container` file with
/// the minimal information necessary to fetch the image.
///
/// In the future this may be extended to include e.g. certificates or
/// other pull options.
#[derive(PartialEq, Eq)]
struct BoundImage {
image: String,
auth_file: Option<String>,
}

/// Given a deployment, pull all container images it references.
pub(crate) fn pull_bound_images(sysroot: &SysrootLock, deployment: &Deployment) -> Result<()> {
let deployment_root = &crate::utils::deployment_fd(sysroot, deployment)?;
Expand Down Expand Up @@ -117,17 +128,6 @@ fn pull_images(_deployment_root: &Dir, bound_images: Vec<BoundImage>) -> Result<
Ok(())
}

/// A subset of data parsed from a `.image` or `.container` file with
/// the minimal information necessary to fetch the image.
///
/// In the future this may be extended to include e.g. certificates or
/// other pull options.
#[derive(PartialEq, Eq)]
struct BoundImage {
image: String,
auth_file: Option<String>,
}

impl BoundImage {
fn new(image: String, auth_file: Option<String>) -> Result<BoundImage> {
let image = parse_spec_value(&image).context("Invalid image value")?;
Expand Down

0 comments on commit 79ed0be

Please sign in to comment.