Skip to content

feat(dfget): add --daemon option to auto-start dfdaemon#1738

Open
CormickKneey wants to merge 1 commit intodragonflyoss:mainfrom
CormickKneey:ck/dfget-opt
Open

feat(dfget): add --daemon option to auto-start dfdaemon#1738
CormickKneey wants to merge 1 commit intodragonflyoss:mainfrom
CormickKneey:ck/dfget-opt

Conversation

@CormickKneey
Copy link
Copy Markdown
Contributor

@CormickKneey CormickKneey commented Mar 19, 2026

Summary

  • Add --daemon flag to dfget that automatically starts a dfdaemon process when one is not already running
  • Add --daemon-manager-addr option to specify the manager address for the auto-generated dfdaemon config

Motivation

Currently dfget requires a running dfdaemon process to function. This makes it inconvenient for ad-hoc downloads, development, and testing scenarios where users need to manually ensure dfdaemon is running. The --daemon option allows dfget to handle this automatically.

Behavior

When --daemon is specified, dfget follows this logic:

  1. UDS exists and dfdaemon is reachable → use the existing dfdaemon (no change from current behavior)
  2. Config file exists → start dfdaemon with the existing config
  3. No config file → generate a default config at the default path and start dfdaemon
  4. No config file + --daemon-manager-addr specified → generate a default config with the specified manager address
  5. Config file exists + --daemon-manager-addr differs from config → warn the user and proceed with the config file address

Usage Examples

# Auto-start dfdaemon with existing config
dfget https://example.com/file.tar.gz -O /tmp/file.tar.gz --daemon

# Auto-start with a specific manager address (generates default config if none exists)
dfget https://example.com/file.tar.gz -O /tmp/file.tar.gz --daemon --daemon-manager-addr=http://manager:65003

# Original behavior is unchanged without --daemon
dfget https://example.com/file.tar.gz -O /tmp/file.tar.gz

Changes

  • dragonfly-client/src/bin/dfget/main.rs: Added --daemon and --daemon-manager-addr CLI arguments, ensure_dfdaemon_config(), find_dfdaemon_binary(), start_dfdaemon(), wait_for_dfdaemon_ready() functions, and updated main() with the auto-start branching logic

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0.42553% with 234 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.36%. Comparing base (f27be76) to head (adb1b73).

Files with missing lines Patch % Lines
dragonfly-client/src/bin/dfget/main.rs 0.42% 234 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1738      +/-   ##
==========================================
- Coverage   46.79%   46.36%   -0.43%     
==========================================
  Files          87       87              
  Lines       24883    25115     +232     
==========================================
+ Hits        11643    11644       +1     
- Misses      13240    13471     +231     
Files with missing lines Coverage Δ
dragonfly-client/src/bin/dfget/main.rs 42.19% <0.42%> (-7.15%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add --daemon and --daemon-manager-addr options to dfget that allow
automatically starting a dfdaemon process when one is not running.

The --daemon option triggers the following behavior:
1. Try connecting to existing dfdaemon via unix socket
2. If config exists, use it to start dfdaemon
3. If no config exists, generate a default one at the default path
4. If --daemon-manager-addr is specified without config, write it
   into the generated default config
5. If config exists and --daemon-manager-addr differs, warn the user
   and use the address from the config file

Signed-off-by: CormickKneey <Cormick1080@gmail.com>
@gaius-qi gaius-qi added the enhancement New feature or request label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants