task

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpansionInput added in v1.3.0

type ExpansionInput struct {
	PanAccountID uint                   `json:"pan_account_id"`
	DataSource   map[string]interface{} `json:"data_source,omitempty"`
}

ExpansionInput 扩容任务输入数据结构

type ExpansionOutput added in v1.3.0

type ExpansionOutput struct {
	Success              bool                  `json:"success"`
	Message              string                `json:"message"`
	Error                string                `json:"error,omitempty"`
	Time                 string                `json:"time"`
	TransferredResources []TransferredResource `json:"transferred_resources,omitempty"`
}

ExpansionOutput 扩容任务输出数据结构

type ExpansionProcessor added in v1.3.0

type ExpansionProcessor struct {
	// contains filtered or unexported fields
}

ExpansionProcessor 扩容任务处理器

func NewExpansionProcessor added in v1.3.0

func NewExpansionProcessor(repoMgr *repo.RepositoryManager) *ExpansionProcessor

NewExpansionProcessor 创建扩容任务处理器

func (*ExpansionProcessor) GetTaskType added in v1.3.0

func (ep *ExpansionProcessor) GetTaskType() string

GetTaskType 获取任务类型

func (*ExpansionProcessor) Process added in v1.3.0

func (ep *ExpansionProcessor) Process(ctx context.Context, taskID uint, item *entity.TaskItem) error

Process 处理扩容任务项

type ShareInfo

type ShareInfo struct {
	PanType string
	ShareID string
	URL     string
}

ShareInfo 分享信息结构

type TaskManager

type TaskManager struct {
	// contains filtered or unexported fields
}

TaskManager 任务管理器

func NewTaskManager

func NewTaskManager(repoMgr *repo.RepositoryManager) *TaskManager

NewTaskManager 创建任务管理器

func (*TaskManager) GetTaskStatus

func (tm *TaskManager) GetTaskStatus(taskID uint) (string, error)

GetTaskStatus 获取任务状态

func (*TaskManager) IsTaskRunning

func (tm *TaskManager) IsTaskRunning(taskID uint) bool

IsTaskRunning 检查任务是否在运行

func (*TaskManager) PauseTask

func (tm *TaskManager) PauseTask(taskID uint) error

PauseTask 暂停任务

func (*TaskManager) RecoverRunningTasks

func (tm *TaskManager) RecoverRunningTasks() error

RecoverRunningTasks 恢复运行中的任务(服务器重启后调用)

func (*TaskManager) RegisterProcessor

func (tm *TaskManager) RegisterProcessor(processor TaskProcessor)

RegisterProcessor 注册任务处理器

func (*TaskManager) StartTask

func (tm *TaskManager) StartTask(taskID uint) error

StartTask 启动任务

func (*TaskManager) StopTask

func (tm *TaskManager) StopTask(taskID uint) error

StopTask 停止任务

type TaskProcessor

type TaskProcessor interface {
	Process(ctx context.Context, taskID uint, item *entity.TaskItem) error
	GetTaskType() string
}

TaskProcessor 任务处理器接口

type TransferInput

type TransferInput struct {
	Title      string `json:"title"`
	URL        string `json:"url"`
	CategoryID uint   `json:"category_id"`
	PanID      uint   `json:"pan_id"`
	Tags       []uint `json:"tags"`
}

TransferInput 转存任务输入数据结构

type TransferOutput

type TransferOutput struct {
	ResourceID uint   `json:"resource_id,omitempty"`
	SaveURL    string `json:"save_url,omitempty"`
	Error      string `json:"error,omitempty"`
	Success    bool   `json:"success"`
	Time       string `json:"time"`
}

TransferOutput 转存任务输出数据结构

type TransferProcessor

type TransferProcessor struct {
	// contains filtered or unexported fields
}

TransferProcessor 转存任务处理器

func NewTransferProcessor

func NewTransferProcessor(repoMgr *repo.RepositoryManager) *TransferProcessor

NewTransferProcessor 创建转存任务处理器

func (*TransferProcessor) GetTaskType

func (tp *TransferProcessor) GetTaskType() string

GetTaskType 获取任务类型

func (*TransferProcessor) Process

func (tp *TransferProcessor) Process(ctx context.Context, taskID uint, item *entity.TaskItem) error

Process 处理转存任务项

type TransferResult

type TransferResult struct {
	Success  bool   `json:"success"`
	SaveURL  string `json:"save_url"`
	Fid      string `json:"fid`
	ErrorMsg string `json:"error_msg"`
}

TransferResult 转存结果

type TransferredResource added in v1.3.0

type TransferredResource struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

TransferredResource 转存成功的资源信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL