Skip to content

Conversation

@cgwalters
Copy link
Collaborator

No description provided.

This is prep for wider usage of it in this project.
Like the containers-image: storage, it is only initialized
on demand right now.

(An obvious next step is to redo things so the ostree storage is also on-demand)

- This is hardcoded to SHA512 right now...but we clearly want
  a way to configure that or maybe we just really default to 512?
- We explicitly bridge between the ostree fsverity enablement
  to the composefs verity enablement
- Right now the usage is just a stub but I plan to expose
  more here

Signed-off-by: Colin Walters <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces initial support for composefs by adding it as a dependency and implementing logic to initialize a composefs repository within the bootc storage. It also includes a new internal test command to verify the integration.

My review focuses on improving thread safety in the lazy initialization of the composefs repository and promoting better error handling practices in the new test command. These changes will enhance the robustness and maintainability of the new functionality.

@cgwalters cgwalters changed the title store: Add support for composefs store: Add support for composefs-rs Jul 31, 2025
@cgwalters cgwalters enabled auto-merge August 1, 2025 02:00
@cgwalters cgwalters mentioned this pull request Aug 1, 2025
1 task

let mut db = DirBuilder::new();
db.mode(COMPOSEFS_MODE.as_raw_mode());
self.physical_root.ensure_dir_with(COMPOSEFS, &db)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not care about the returned bool for anything here? We just rely on the fact that if there's an error, we're unwraping it and we will return the error. The returned bool isn't really useful for us in this context I guess?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it just says whether or not the directory existed already which is information we don't need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. It would never make it to the next line if there was an error returned from ensure_dir_with(). There's no logical need to store and reference the returned value.

Comment on lines +177 to +178
let r = Arc::clone(self.composefs.get_or_init(|| composefs));
Ok(r)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted your response to Gemini below, you mentioned you only expect this to be called once and don't necessarily require thread safety here. I'm just curious about your use of Arc over rc in that case? Since Arc is slightly more computationally expensive, I'm curious to understand your thought process.

There's every possibility that my lack of Rust experience is causing me to overlook something. In which case, consider this a question for my own educational purposes rather than a functional critique of your PR per se. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying API wants Arc https://github.com/containers/composefs-rs/blob/126751dee8a71aa54c9666e69645d2fd1eccb176/crates/composefs/src/repository.rs#L112

Ultimately we definitely don't care about the refcounting overhead here, and in general Arc is needed for things like tokio with work stealing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case, consider this a question for my own educational purposes rather than a functional critique of your PR per se. :)

Yes that's fine! Thanks for looking at the PR!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, that makes sense then. Thanks for the clarification.

@cgwalters cgwalters requested a review from jeckersb August 1, 2025 15:43
@cgwalters cgwalters merged commit 7578551 into bootc-dev:main Aug 1, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants