- Add TestRunDaemon_CancelledContext: exercises RunDaemon with a
daemon-friendly config, cancels via context, verifies clean return
and startup output
- Remove unused daemonWatcherBatchDelay constant (batch-settle logic
was never implemented; the watcher loop records changes immediately)
- Update TestDaemonConstants to remove reference to deleted constant
Replace the daemon mode stub with a full implementation that:
- Watches configured snapshot paths for filesystem changes using
fsnotify (inotify on Linux, FSEvents on macOS, etc.)
- Runs an initial full backup on startup
- Triggers incremental backups at backup_interval when changes are
detected, only for snapshots whose paths were affected
- Performs full periodic scans at full_scan_interval regardless of
detected changes
- Respects min_time_between_run to prevent excessive backup runs
- Handles SIGTERM/SIGINT for graceful shutdown, completing any
in-progress backup before exiting
- Automatically watches newly created subdirectories
- Uses a backup semaphore to prevent concurrent backup runs
New files:
- internal/vaultik/daemon.go: RunDaemon(), changeTracker, watcher setup
- internal/vaultik/daemon_test.go: Tests for changeTracker, isSubpath,
concurrency safety, and daemon constants
closes#3