Skip to content

feat: Stream NAR downloads to clients while still downloading - #272

Merged
kalbasit merged 7 commits into
mainfrom
clients_access_partial_download
Aug 24, 2025
Merged

kalbasit merged 7 commits into
mainfrom
clients_access_partial_download

Conversation

@kalbasit

@kalbasit kalbasit commented Aug 24, 2025 •

Copy link
Copy Markdown
Owner

Streaming NAR Downloads

This PR implements streaming NAR downloads, allowing clients to start receiving data as soon as it becomes available rather than waiting for the entire download to complete.

Key changes:

  • Added a streaming mechanism using a pipe to send data to clients as it's downloaded
  • Enhanced downloadState with mutex, condition variable, and progress tracking
  • Modified the NAR download process to write in chunks and notify waiting clients
  • Updated server code to handle streaming responses with unknown final size
  • Fixed tests to properly handle streaming responses

The implementation uses a producer-consumer pattern where the download process writes chunks to a file while simultaneously streaming those chunks to connected clients. This improves performance by eliminating the need to wait for complete downloads before serving content.

fixes #20

@kalbasit
kalbasit marked this pull request as ready for review August 24, 2025 22:28
@kalbasit kalbasit changed the title wip feat: Stream NAR downloads to clients while still downloading Aug 24, 2025
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch from fadbbcd to a886b1b Compare August 24, 2025 22:46
@kalbasit
kalbasit force-pushed the remove_temp_file_outside_download_fn branch 2 times, most recently from 89cd2a9 to 03646b4 Compare August 24, 2025 22:53
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch 2 times, most recently from ca38990 to 41f69c4 Compare August 24, 2025 22:59
@kalbasit
kalbasit force-pushed the remove_temp_file_outside_download_fn branch 3 times, most recently from d4d29fc to 8e17203 Compare August 24, 2025 23:09
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch from 41f69c4 to c173ae8 Compare August 24, 2025 23:10
@kalbasit
kalbasit force-pushed the remove_temp_file_outside_download_fn branch from 8e17203 to 1823c8d Compare August 24, 2025 23:10
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch from c173ae8 to f5e94bf Compare August 24, 2025 23:10
@kalbasit
kalbasit changed the base branch from remove_temp_file_outside_download_fn to graphite-base/272 August 24, 2025 23:18
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch from f5e94bf to 6d20783 Compare August 24, 2025 23:19
@kalbasit
kalbasit changed the base branch from graphite-base/272 to main August 24, 2025 23:19
@kalbasit
kalbasit force-pushed the clients_access_partial_download branch from 6d20783 to 6446e61 Compare August 24, 2025 23:19
@kalbasit
kalbasit merged commit 65733dc into main Aug 24, 2025

Copy link
Copy Markdown
Owner Author

Merge activity

@kalbasit
kalbasit deleted the clients_access_partial_download branch August 24, 2025 23:27
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.

Large files cause timeout issues downstream

1 participant