Architecture
Overview
Section titled “Overview”WarpDL uses a daemon-based architecture with parallel segment downloading.
┌─────────────────────────────────────────────┐│ warpdl ││ (single binary) │├─────────────────┬───────────────────────────┤│ CLI │ Daemon │└────────┬────────┴──────────┬────────────────┘ └───────────┬───────┘ ▼ ┌──────────┐ │ warplib │ └──────────┘Package Structure
Section titled “Package Structure”| Package | Description |
|---|---|
cmd/ |
CLI commands using urfave/cli |
pkg/warplib/ |
Core download engine |
pkg/warpcli/ |
CLI-to-daemon communication |
pkg/credman/ |
Credential management with OS keyring |
pkg/logger/ |
Logger utilities |
internal/server/ |
Daemon server (Unix socket/TCP) |
internal/api/ |
API handlers |
internal/extl/ |
JavaScript extension engine |
internal/daemon/ |
Daemon implementation |
internal/scheduler/ |
Download scheduling |
internal/service/ |
Service management |
common/ |
Shared types and constants |
Data Flow
Section titled “Data Flow”CLI → pkg/warpcli → Socket → internal/server → internal/api → pkg/warplib → HTTPKey Design Patterns
Section titled “Key Design Patterns”- Handler Pattern: Event callbacks for progress tracking
- Manager Pattern: Centralized state in Manager (warplib)
- Daemon Architecture: Single daemon serves multiple CLI clients
Download callbacks persist the manager’s current item map without registering their own item again.
Registration uses UpdateItem/UpdateItemAsync; a late callback after FlushOne, Flush,
or PurgeFailedDownload cannot restore a removed item or overwrite a replacement.
Destination claims and queue completion/stop events apply only while the callback’s item is current,
so stale callbacks cannot release a replacement’s queue slot.
Storage
Section titled “Storage”| Path | Contents |
|---|---|
~/.config/warpdl/userdata.warp |
Download metadata (GOB encoded) |
~/.config/warpdl/dldata/ |
Partial segment data |
~/.config/warpdl/extstore/ |
Installed extensions |
/tmp/warpdl.sock |
Daemon socket (Linux/macOS) |
\\.\pipe\warpdl |
Daemon named pipe (Windows) |
