Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DownloadTaskManager *tache.Manager[*DownloadTask]
View Source
var (
Tools = make(ToolsManager)
)
View Source
var (
TransferTaskManager *tache.Manager[*TransferTask]
)
Functions ¶
func AddURL ¶
func AddURL(ctx context.Context, args *AddURLArgs) (task.TaskExtensionInfo, error)
Types ¶
type AddURLArgs ¶
type AddURLArgs struct {
URL string
DstDirPath string
Tool string
DeletePolicy DeletePolicy
}
type DeletePolicy ¶
type DeletePolicy string
const ( DeleteOnUploadSucceed DeletePolicy = "delete_on_upload_succeed" DeleteOnUploadFailed DeletePolicy = "delete_on_upload_failed" DeleteNever DeletePolicy = "delete_never" DeleteAlways DeletePolicy = "delete_always" UploadDownloadStream DeletePolicy = "upload_download_stream" )
type DownloadTask ¶
type DownloadTask struct {
task.TaskExtension
Url string `json:"url"`
DstDirPath string `json:"dst_dir_path"`
TempDir string `json:"temp_dir"`
DeletePolicy DeletePolicy `json:"delete_policy"`
Toolname string `json:"toolname"`
Status string `json:"-"`
Signal chan int `json:"-"`
GID string `json:"-"`
// contains filtered or unexported fields
}
func (*DownloadTask) GetName ¶
func (t *DownloadTask) GetName() string
func (*DownloadTask) GetStatus ¶
func (t *DownloadTask) GetStatus() string
func (*DownloadTask) Run ¶
func (t *DownloadTask) Run() error
func (*DownloadTask) Transfer ¶
func (t *DownloadTask) Transfer() error
func (*DownloadTask) Update ¶
func (t *DownloadTask) Update() (bool, error)
Update download status, return true if download completed
type Tool ¶
type Tool interface {
Name() string
// Items return the setting items the tool need
Items() []model.SettingItem
Init() (string, error)
IsReady() bool
// AddURL add an uri to download, return the task id
AddURL(args *AddUrlArgs) (string, error)
// Remove the download if task been canceled
Remove(task *DownloadTask) error
// Status return the status of the download task, if an error occurred, return the error in Status.Err
Status(task *DownloadTask) (*Status, error)
// Run for simple http download
Run(task *DownloadTask) error
}
type ToolsManager ¶
func (ToolsManager) Add ¶
func (t ToolsManager) Add(tool Tool)
func (ToolsManager) Items ¶
func (t ToolsManager) Items() []model.SettingItem
func (ToolsManager) Names ¶
func (t ToolsManager) Names() []string
type TransferTask ¶
type TransferTask struct {
fs.TaskData
DeletePolicy DeletePolicy `json:"delete_policy"`
Url string `json:"url"`
// contains filtered or unexported fields
}
func (*TransferTask) GetName ¶
func (t *TransferTask) GetName() string
func (*TransferTask) OnFailed ¶
func (t *TransferTask) OnFailed()
func (*TransferTask) OnSucceeded ¶
func (t *TransferTask) OnSucceeded()
func (*TransferTask) Run ¶
func (t *TransferTask) Run() error
func (*TransferTask) SetRetry ¶ added in v4.0.9
func (t *TransferTask) SetRetry(retry int, maxRetry int)
Click to show internal directories.
Click to hide internal directories.