Documentation
¶
Index ¶
- type Task
- type TaskID
- type TaskManager
- func (tm *TaskManager) Cancel(id TaskID, onDelete func())
- func (tm *TaskManager) Execute(id TaskID) error
- func (tm *TaskManager) Extend(id TaskID, duration time.Duration) error
- func (tm *TaskManager) SetInterval(task func(context.Context), interval time.Duration) TaskID
- func (tm *TaskManager) SetTimeout(task func(ctx context.Context), duration time.Duration) TaskID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task represents a scheduled task, either one-shot or recurring.
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
TaskManager is responsible for managing tasks. It supports scheduling, canceling, and extending tasks.
func NewTaskManager ¶
func NewTaskManager() *TaskManager
NewTaskManager creates and initializes a TaskManager.
func (*TaskManager) Cancel ¶
func (tm *TaskManager) Cancel(id TaskID, onDelete func())
Cancel cancels a task and optionally executes a cleanup function.
func (*TaskManager) Execute ¶
func (tm *TaskManager) Execute(id TaskID) error
Execute triggers a task immediately and remove from tasks.
func (*TaskManager) Extend ¶
func (tm *TaskManager) Extend(id TaskID, duration time.Duration) error
Extend adds additional duration to a task.
func (*TaskManager) SetInterval ¶
SetInterval schedules a recurring task with a specified interval.
func (*TaskManager) SetTimeout ¶
SetTimeout schedules a one-shot task to be executed after a specified duration.
Click to show internal directories.
Click to hide internal directories.