new
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
"tyapi-server/internal/infrastructure/task/entities"
|
||||
"tyapi-server/internal/infrastructure/task/types"
|
||||
)
|
||||
|
||||
// ArticleTaskQueue 文章任务队列接口
|
||||
type ArticleTaskQueue interface {
|
||||
// Enqueue 入队任务
|
||||
Enqueue(ctx context.Context, taskType types.TaskType, payload types.TaskPayload) error
|
||||
|
||||
// EnqueueDelayed 延时入队任务
|
||||
EnqueueDelayed(ctx context.Context, taskType types.TaskType, payload types.TaskPayload, delay time.Duration) error
|
||||
|
||||
// EnqueueAt 指定时间入队任务
|
||||
EnqueueAt(ctx context.Context, taskType types.TaskType, payload types.TaskPayload, scheduledAt time.Time) error
|
||||
|
||||
// Cancel 取消任务
|
||||
Cancel(ctx context.Context, taskID string) error
|
||||
|
||||
// ModifySchedule 修改任务调度时间
|
||||
ModifySchedule(ctx context.Context, taskID string, newScheduledAt time.Time) error
|
||||
|
||||
// GetTaskStatus 获取任务状态
|
||||
GetTaskStatus(ctx context.Context, taskID string) (*entities.AsyncTask, error)
|
||||
|
||||
// ListTasks 列出任务
|
||||
ListTasks(ctx context.Context, taskType types.TaskType, status entities.TaskStatus, limit int) ([]*entities.AsyncTask, error)
|
||||
}
|
||||
Reference in New Issue
Block a user