Add support for oci-archives#78
Merged
Merged
Conversation
Move read_blob, read_index, has_blob, and all derived read-only methods (fsck, find_referrers, open_image_this_platform, etc.) from impl OciDir into a new OciRead trait with default methods. OciDir implements the trait, so all existing call sites work once OciRead is in scope. A prelude module re-exports OciRead for convenient importing. This prepares for adding OciArchive (read-only tar-based backend) that will share the same read logic via the trait without any code duplication. It changes none of the behaviour, or the API (other than the requirement to import that prelude to use the trait). Signed-off-by: Alexander Larsson <alexl@redhat.com> Assisted-by: Claude Code (Claude Opus 4.6)
Add OciArchive, a read-only OCI image backend that reads directly from tar archives using pread for concurrent access. It implements OciRead so all manifest resolution, fsck, and referrer logic works without code duplication. Key changes: - ArchiveReader: a Read+Seek adapter over a region of a file using pread - OciArchive: scans tar entries on open, serves reads via ArchiveReader Assisted-by: Claude Code (Claude Opus 4.6) Signed-off-by: Alexander Larsson <alexl@redhat.com>
cgwalters
approved these changes
Jun 16, 2026
|
|
||
| /// A reader for a region of a file, using pread for concurrent access. | ||
| #[derive(Debug)] | ||
| pub struct ArchiveReader { |
Collaborator
There was a problem hiding this comment.
Minor bike shed perhaps FileRangeReader
|
|
||
| /// A reader for a region of a file, using pread for concurrent access. | ||
| #[derive(Debug)] | ||
| pub struct ArchiveReader { |
Collaborator
There was a problem hiding this comment.
I don't think this should be pub - let's audit this code for unnecessary pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for read-only access to oci-archives by abstracting out the read part of OciDir to a trait that then has a OciDir implementation and an OciArchive implementation.
The goal of this is to use it in composefs-rs to do an efficient local version of delta pulls without using the skopeo proxy (although it will also work for regular local oci-archive pulls).
This change is essentially API compat, except users need to add
use ocidir::prelude::*to pull in the new trait.