Documentation
¶
Index ¶
- Constants
- func AddToMasterList(entry types.DownloadEntry) error
- func CheckDownloadExists(url string) (bool, error)
- func ClearRateLimit(id string) error
- func CloseDB()
- func Configure(path string)
- func DeleteState(id string) error
- func DeleteTasks(id string) error
- func GetDownload(id string) (*types.DownloadEntry, error)
- func ListAllDownloads() ([]types.DownloadEntry, error)
- func LoadCompletedDownloads() ([]types.DownloadEntry, error)
- func LoadMasterList() (*types.MasterList, error)
- func LoadPausedDownloads() ([]types.DownloadEntry, error)
- func LoadState(url string, destPath string) (*types.DownloadState, error)
- func LoadStates(ids []string) (map[string]*types.DownloadState, error)
- func NormalizeStaleDownloads() (int, error)
- func PauseAllDownloads() error
- func RemoveCompletedDownloads() (int64, error)
- func RemoveFailedDownloads() (int64, error)
- func RemoveFromMasterList(id string) error
- func ResumeAllDownloads() error
- func SaveState(url string, destPath string, state *types.DownloadState) error
- func SaveStateWithOptions(url string, destPath string, state *types.DownloadState, opts SaveStateOptions) error
- func URLHash(url string) string
- func UpdateDefaultRateLimit(id string, rate int64) error
- func UpdateRateLimit(id string, rate int64) error
- func UpdateStatus(id string, status string) error
- func UpdateURL(id string, newURL string) error
- func ValidateIntegrity() (int, error)
- type DetailState
- type MasterState
- type SaveStateOptions
Constants ¶
const (
DefaultInlineHashTimeout = 10 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func AddToMasterList ¶
func AddToMasterList(entry types.DownloadEntry) error
func CheckDownloadExists ¶
func ClearRateLimit ¶ added in v0.9.0
ClearRateLimit removes a download-specific rate limit override.
func Configure ¶
func Configure(path string)
Configure sets the base directory for the custom state backend. It accepts a file path (e.g., legacy downloads.db) for backward compatibility, avoiding a massive refactor of all startup paths that pass a database file path. It extracts and uses the parent directory for Gob state.
func DeleteState ¶
func DeleteTasks ¶
func GetDownload ¶
func GetDownload(id string) (*types.DownloadEntry, error)
func ListAllDownloads ¶
func ListAllDownloads() ([]types.DownloadEntry, error)
func LoadCompletedDownloads ¶
func LoadCompletedDownloads() ([]types.DownloadEntry, error)
func LoadMasterList ¶
func LoadMasterList() (*types.MasterList, error)
func LoadPausedDownloads ¶
func LoadPausedDownloads() ([]types.DownloadEntry, error)
func LoadStates ¶
func LoadStates(ids []string) (map[string]*types.DownloadState, error)
func NormalizeStaleDownloads ¶
NormalizeStaleDownloads resets downloads that were interrupted (e.g., app crash) and appear as dead/frozen items in the TUI.
func PauseAllDownloads ¶
func PauseAllDownloads() error
func RemoveFailedDownloads ¶ added in v0.10.0
func RemoveFromMasterList ¶
func ResumeAllDownloads ¶
func ResumeAllDownloads() error
func SaveStateWithOptions ¶
func SaveStateWithOptions(url string, destPath string, state *types.DownloadState, opts SaveStateOptions) error
func UpdateDefaultRateLimit ¶ added in v0.9.0
UpdateDefaultRateLimit updates the inherited rate limit of a download only if the download does not have a user-set override.
func UpdateRateLimit ¶ added in v0.9.0
UpdateRateLimit updates the rate limit of a download in the database
func UpdateStatus ¶
func ValidateIntegrity ¶
ValidateIntegrity checks that paused .surge files still exist and haven't been tampered with. Removes orphaned or corrupted entries from the master list. Returns the number of entries removed.
Types ¶
type DetailState ¶ added in v0.10.0
type DetailState struct {
Version int
State *types.DownloadState
}
type MasterState ¶ added in v0.10.0
type MasterState struct {
Version int
Downloads []types.DownloadEntry
}