Fetcher defines the interface for a download protocol. Each download task will have a corresponding Fetcher instance for the management of the download task
| 11 | // Fetcher defines the interface for a download protocol. |
| 12 | // Each download task will have a corresponding Fetcher instance for the management of the download task |
| 13 | type Fetcher interface { |
| 14 | Setup(ctl *controller.Controller) |
| 15 | Resolve(req *base.Request, opts *base.Options) error |
| 16 | Start() error |
| 17 | // Patch modifies task-specific data based on the protocol. |
| 18 | // For HTTP: can modify Request info (URL, headers, etc.) |
| 19 | // For BT: can modify SelectFiles (via opts.SelectFiles) |
| 20 | Patch(req *base.Request, opts *base.Options) error |
| 21 | Pause() error |
| 22 | Close() error |
| 23 | |
| 24 | // Stats refreshes health statistics and returns the latest information |
| 25 | Stats() any |
| 26 | // Meta returns the meta information of the download. |
| 27 | Meta() *FetcherMeta |
| 28 | // Progress returns the progress of the download. |
| 29 | Progress() Progress |
| 30 | // Wait for the download to complete, this method will block until the download is done. |
| 31 | Wait() error |
| 32 | } |
| 33 | |
| 34 | type Uploader interface { |
| 35 | Upload() error |
no outgoing calls
no test coverage detected