Implement HTTP Range request support for getBlob endpoint#57
Merged
DavidBuchanan314 merged 2 commits intomainfrom Oct 4, 2025
Merged
Implement HTTP Range request support for getBlob endpoint#57DavidBuchanan314 merged 2 commits intomainfrom
DavidBuchanan314 merged 2 commits intomainfrom
Conversation
Add comprehensive range request support to com.atproto.sync.getBlob with optimized blob size calculation and selective part fetching. Changes: - Add BLOB_PART_SIZE constant to static_config.py (64KB) - Update blob upload to use centralized BLOB_PART_SIZE constant - Implement range request handling using aiohttp's http_range property - Support normal ranges (bytes=start-end), open-ended (bytes=start-), and suffix ranges (bytes=-count) - Return 206 Partial Content with Content-Range header for ranges - Return 416 Range Not Satisfiable for invalid ranges - Add Accept-Ranges: bytes header to all responses - Optimize blob size calculation: count parts + last part length instead of scanning all parts - Optimize part fetching: only fetch required part indices from database Tests: - Add comprehensive range request tests covering all range types - Add edge case tests for 64KB part boundary conditions - Add zero-length blob test - All 74 tests passing
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements HTTP Range request support for the com.atproto.sync.getBlob endpoint, allowing clients to request specific byte ranges from blobs. This enables partial content downloads and better support for resumable downloads.
- Add centralized
BLOB_PART_SIZEconstant (64KB) to static configuration - Implement comprehensive range request handling with optimized blob size calculation and selective part fetching
- Add extensive test coverage for various range request scenarios including edge cases and boundary conditions
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/millipds/static_config.py | Adds centralized BLOB_PART_SIZE constant (64KB) with documentation |
| src/millipds/atproto_repo.py | Updates blob upload to use the centralized BLOB_PART_SIZE constant |
| src/millipds/atproto_sync.py | Implements HTTP range request handling with optimized blob size calculation and selective part fetching |
| tests/test_blob_management.py | Adds comprehensive test coverage for range requests including boundary conditions and edge cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Implements #33
Add comprehensive range request support to com.atproto.sync.getBlob with optimized blob size calculation and selective part fetching. (via claude)
Changes:
Tests: