Draft
Replace gRPC download call in proxy with local download_task using task manager#1915
Conversation
Copilot created this pull request from a session on behalf of
gaius-qi
July 10, 2026 00:22
View session
…ut of download_task
…task.rs - Move `download_task` and `prefetch_task` functions into new `proxy/task.rs` - Rename them to `task::download` and `task::prefetch` with public visibility - Clean up unused imports in `proxy/mod.rs` after the extraction - Declare `task` as a public submodule in `proxy/mod.rs Signed-off-by: Gaius <gaius.qi@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1915 +/- ##
==========================================
- Coverage 46.11% 45.85% -0.27%
==========================================
Files 93 94 +1
Lines 23526 23662 +136
==========================================
Hits 10850 10850
- Misses 12676 12812 +136
🚀 New features to boost your workflow:
|
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.
The proxy downloaded tasks through the dfdaemon download gRPC client over a unix socket (
dfdaemon_download_client.download_taskinproxy/mod.rs), adding unnecessary gRPC transport overhead to every proxied download. This implements the samedownload_tasklogic locally in the proxy usingresource::task::Taskfunctions directly, removing the gRPC hop.Local
download_taskinproxy/mod.rsMirrors the gRPC
download_taskhandler ingrpc/dfdaemon_download.rs, but calls the task manager directly:task.id_generator(content, blob-digest-based, and URL-basedTaskIDParameter).task.download_started, resolves the range from the request header viaget_range, then spawnstask.downloadwriting into a localmpscchannel (DOWNLOAD_STREAM_BUFFER_SIZE), returning the receiver as the response stream.download_finished, output-path hard-link/copy checks, digest verification), failure path (download_failed, backend error details), and all download task metrics.Request/Responsewrappers, OpenTelemetry context extraction, and blocklist checks.Local
prefetch_taskMirrors
grpc::prefetch_taskbut invokes the localdownload_taskinstead of creating a gRPC client.download_taskreturns a boxed future to break the recursive future type betweendownload_taskandprefetch_task.proxy_via_dfdaemonreworkmpsc::Receiver<Result<DownloadTaskResponse, Status>>instead of a tonic stream.ClientError::BackendErrordirectly (status code + headers) instead of decoding tonicStatusdetails JSON.ResourceExhausted/PermissionDeniedmappings that only originated from gRPC server middleware.Cleanup
Removed
DfdaemonDownloadClientconstruction fromProxy::runand its parameter from all proxy handlers (handler,http_handler,https_handler,upgraded_tunnel,upgraded_handler, registry mirror handlers).