Skip to content

Implement HTTP Range request support for getBlob endpoint#57

Merged
DavidBuchanan314 merged 2 commits intomainfrom
blob-range-requests
Oct 4, 2025
Merged

Implement HTTP Range request support for getBlob endpoint#57
DavidBuchanan314 merged 2 commits intomainfrom
blob-range-requests

Conversation

@DavidBuchanan314
Copy link
Copy Markdown
Owner

@DavidBuchanan314 DavidBuchanan314 commented Oct 4, 2025

Implements #33

Add comprehensive range request support to com.atproto.sync.getBlob with optimized blob size calculation and selective part fetching. (via claude)

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

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_SIZE constant (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.

Comment thread src/millipds/atproto_sync.py
Comment thread src/millipds/atproto_sync.py
Comment thread src/millipds/atproto_sync.py
@DavidBuchanan314 DavidBuchanan314 merged commit 3e28a34 into main Oct 4, 2025
4 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.

2 participants