Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAddTaskFailed = errors.New("add task failed") ErrRemoveTaskFailed = errors.New("remove task failed") ErrGetTaskFailed = errors.New("get task failed") ErrNoTasks = errors.New("no tasks") )
View Source
var DefaultCurrentTimeResolver = func() time.Time { return time.Now().UTC() }
Functions ¶
This section is empty.
Types ¶
type BaseScheduler ¶
type BaseScheduler interface { AddTask(ctx context.Context, task *Task, at time.Time) error ProcessTasks(ctx context.Context, callback Callback) error RemoveTask(ctx context.Context, id string) error }
func NewScheduler ¶
func NewScheduler( threads int, storage Storage, getCurrentTime CurrentTimeResolver, logger *log.Logger, ) BaseScheduler
type CurrentTimeResolver ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func (*Scheduler) ProcessTasks ¶
type Storage ¶
type Storage interface { Add(ctx context.Context, Task *Task, at time.Time) error GetNext(ctx context.Context) (*Task, error) RemoveBackup(ctx context.Context, id string) error GetBack(ctx context.Context, task *Task) error RestoreFromBackup(ctx context.Context, earlyThen time.Time) error Remove(ctx context.Context, id string) error }
Click to show internal directories.
Click to hide internal directories.