-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.go
More file actions
28 lines (25 loc) · 1.45 KB
/
task.go
File metadata and controls
28 lines (25 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package apiq
type Task struct {
ID int `json:"id"` // Номер в очереди
State string `json:"state"` // Статус: В процессе/В очереди/Завершена
NumElements int `json:"n"` // количество элементов
Delta float64 `json:"d"` // дельта между элементами последовательности
StartValue float64 `json:"n1"` // Стартовое значение
Interval float64 `json:"I"` // интервал в секундах между итерациями
TTL float64 `json:"TTL"` // время хранения результата в секундах
CurrentIter int `json:"currentIter"` // Текущая итерация
CurrentVal float64 `json:"currentVal"` // Текущее значение
CreatedAt string `json:"createdt"` // Время постановки задачи
StartedAt string `json:"startedAt,omitempty"` // Время старта задачи
CompletedAt string `json:"completedAt,omitempty"` // Время окончания задачи
}
const (
//Task states
StateInProgress = "in progress"
StateInQueue = "in queue"
StateCompleted = "completed"
)
type TaskService interface {
FindTasks() ([]*Task, error)
CreateTask(t *Task) error
}