Use HTTP range requests for uncompressed layer fetches in libindex#1948
Open
ushaket wants to merge 2 commits into
Open
Use HTTP range requests for uncompressed layer fetches in libindex#1948ushaket wants to merge 2 commits into
ushaket wants to merge 2 commits into
Conversation
ushaket
force-pushed
the
http-range-reader
branch
from
July 14, 2026 14:43
fe408b1 to
babd4ee
Compare
Use a range-backed ReaderAt for uncompressed layers so libindex can avoid downloading and spooling large blobs when scanners only need tar metadata or a small subset of files. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Uri Shaket <ushaket@redhat.com>
ushaket
force-pushed
the
http-range-reader
branch
from
July 14, 2026 17:13
babd4ee to
c12b7d7
Compare
Use compressed fixtures in TestFetchConcurrent so the test continues to exercise the cached full-download path instead of assuming uncompressed layers only require a single fetch. Signed-off-by: Uri Shaket <ushaket@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Use HTTP range requests for uncompressed layer fetches in libindex instead of downloading the full blob up front. This lets claircore access large uncompressed layers lazily through io.ReaderAt, while keeping the existing full-download behavior for compressed layers.
Related Issues
Changes
HTTP range-backed layer access
internal/httputil.RangeReaderAt, anio.ReaderAtimplementation backed by HTTPRangerequeststarfswalks tar headerszreader.DetectCompressionFetcher behavior
libindex/fetcher.goto probe layers withRange: bytes=0-15libindexnow initializes the layer directly fromRangeReaderAtTest coverage
RangeReaderAtRangerequestContext
Claircore already builds
tarfsfromio.ReaderAt, which means scanners do not require a fully downloaded layer stream up front. By switching uncompressed layers to an HTTP range-backed reader, the existing indexing and scanning pipeline can stay unchanged while avoiding unnecessary transfer of large blob contents.This is especially useful for large uncompressed model/data layers, where scanners typically only need tar metadata or a small number of files.
Testing
In-repo automated tests
internal/httputil/rangereaderat_test.golibindex/fetcher_range_test.goReal-image validation
Validated the behavior against live registries and real images:
registry.redhat.iomodelcar images:.safetensorslayers were accessed through small ranged reads without full blob downloadspython:3.12-slimtomcat:10.1-jdk17-temurincentos:stream9A/B equivalence validation
Ran a fixture-based comparison of old vs new fetch behavior and confirmed equivalent scanner results for:
The same fixture runs also showed that irrelevant uncompressed blob content was fully downloaded with the old path and avoided with the new range-backed path.
Examples
Uncompressed layer
Before:
After:
RangeReaderAttarfsand scanners request only the byte ranges they needCompressed layer
Before:
After:
Assisted-by: Claude Opus 4.6