Documentation ¶
Index ¶
- func IsNotFound(err error) bool
- type Option
- type Service
- func (s *Service) AddRunLog(ctx context.Context, taskID, runID platform.ID, when time.Time, log string) error
- func (s *Service) CancelRun(ctx context.Context, taskID, runID platform.ID) error
- func (s *Service) Close() error
- func (s *Service) CreateRun(ctx context.Context, taskID platform.ID, scheduledFor time.Time, ...) (*taskmodel.Run, error)
- func (s *Service) CreateTask(ctx context.Context, tc taskmodel.TaskCreate) (*taskmodel.Task, error)
- func (s *Service) CurrentlyRunning(ctx context.Context, taskID platform.ID) ([]*taskmodel.Run, error)
- func (s *Service) DeleteTask(ctx context.Context, id platform.ID) error
- func (s *Service) FindLogs(ctx context.Context, filter taskmodel.LogFilter) ([]*taskmodel.Log, int, error)
- func (s *Service) FindRunByID(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (s *Service) FindRuns(ctx context.Context, filter taskmodel.RunFilter) ([]*taskmodel.Run, int, error)
- func (s *Service) FindTaskByID(ctx context.Context, id platform.ID) (*taskmodel.Task, error)
- func (s *Service) FindTasks(ctx context.Context, filter taskmodel.TaskFilter) ([]*taskmodel.Task, int, error)
- func (s *Service) FinishRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (s *Service) ForceRun(ctx context.Context, taskID platform.ID, scheduledFor int64) (*taskmodel.Run, error)
- func (s *Service) ManualRuns(ctx context.Context, taskID platform.ID) ([]*taskmodel.Run, error)
- func (s *Service) Open() error
- func (s *Service) RetryRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (s *Service) StartManualRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (s *Service) UpdateRunState(ctx context.Context, taskID, runID platform.ID, when time.Time, ...) error
- func (s *Service) UpdateTask(ctx context.Context, id platform.ID, upd taskmodel.TaskUpdate) (*taskmodel.Task, error)
- type StorageService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
Types ¶
type Service ¶
type Service struct { IDGenerator platform.IDGenerator // contains filtered or unexported fields }
func New ¶
func New(kv StorageService, opts ...Option) *Service
func (*Service) AddRunLog ¶
func (s *Service) AddRunLog(ctx context.Context, taskID, runID platform.ID, when time.Time, log string) error
AddRunLog adds a log line to the run.
func (*Service) CreateRun ¶
func (s *Service) CreateRun(ctx context.Context, taskID platform.ID, scheduledFor time.Time, runAt time.Time) (*taskmodel.Run, error)
CreateRun creates a run with a scheduledFor time as now.
func (*Service) CreateTask ¶
CreateTask creates a new task. The owner of the task is inferred from the authorizer associated with ctx.
func (*Service) CurrentlyRunning ¶
func (*Service) DeleteTask ¶
DeleteTask removes a task by ID and purges all associated data and scheduled runs.
func (*Service) FindLogs ¶
func (s *Service) FindLogs(ctx context.Context, filter taskmodel.LogFilter) ([]*taskmodel.Log, int, error)
FindLogs returns logs for a run.
func (*Service) FindRunByID ¶
func (s *Service) FindRunByID(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
FindRunByID returns a single run.
func (*Service) FindRuns ¶
func (s *Service) FindRuns(ctx context.Context, filter taskmodel.RunFilter) ([]*taskmodel.Run, int, error)
FindRuns returns a list of runs that match a filter and the total count of returned runs.
func (*Service) FindTaskByID ¶
FindTaskByID returns a single task
func (*Service) FindTasks ¶
func (s *Service) FindTasks(ctx context.Context, filter taskmodel.TaskFilter) ([]*taskmodel.Task, int, error)
FindTasks returns a list of tasks that match a filter (limit 100) and the total count of matching tasks.
func (*Service) FinishRun ¶
FinishRun removes runID from the list of running tasks and if its `now` is later then last completed update it.
func (*Service) ForceRun ¶
func (s *Service) ForceRun(ctx context.Context, taskID platform.ID, scheduledFor int64) (*taskmodel.Run, error)
ForceRun forces a run to occur with unix timestamp scheduledFor, to be executed as soon as possible. The value of scheduledFor may or may not align with the task's schedule.
func (*Service) ManualRuns ¶
func (*Service) RetryRun ¶
RetryRun creates and returns a new run (which is a retry of another run).