Versions in this module Expand all Collapse all v0 v0.1.1 Apr 12, 2026 v0.1.0 Apr 12, 2026 Changes in this version + type PriorityQueue struct + func (pq *PriorityQueue) GetPosition(taskID string) int + func (pq *PriorityQueue) Len() int + func (pq *PriorityQueue) Pop() any + func (pq *PriorityQueue) Push(task any, priority int, taskID string) + func (pq *PriorityQueue) Remove(taskID string) bool + type Scheduler struct + func NewScheduler[P, R any](workerCount int, logger *zap.Logger) *Scheduler[P, R] + func (s *Scheduler[P, R]) CancelTaskByID(taskID string) bool + func (s *Scheduler[P, R]) GetTaskPosition(taskID string) int + func (s *Scheduler[P, R]) QueueLen() int + func (s *Scheduler[P, R]) RunningCount() int32 + func (s *Scheduler[P, R]) SubmitTask(ctx context.Context, priority int, param P, ...) *Task[P, R] + type Task struct + Err chan error + Handler func(ctx context.Context, params Params) (Result, error) + ID string + Params Params + Priority int + Progress atomic.Int32 + Result chan Result + Status atomic.Value + SubmitTime time.Time + type TaskPool struct + func NewTaskPool[Param any, Result any](options *TaskPoolOption) *TaskPool[Param, Result] + func (tp *TaskPool[P, R]) AddTask(ctx context.Context, param P, ...) (*Task[P, R], error) + func (tp *TaskPool[P, R]) CancelTask(task *Task[P, R]) + func (tp *TaskPool[P, R]) QueueLen() int + func (tp *TaskPool[P, R]) Running() int32 + func (tp *TaskPool[P, R]) Wait() + func (tp *TaskPool[P, R]) WorkerCount() int + type TaskPoolOption struct + QueueSize int + WorkerCount int + type TaskStatus string + const TaskStatusCancel + const TaskStatusFailed + const TaskStatusPending + const TaskStatusRunning + const TaskStatusSuccess + func (ts TaskStatus) ToString() string