59 lines
1.2 KiB
Go
59 lines
1.2 KiB
Go
package constants
|
|
|
|
import "fmt"
|
|
|
|
const WORKER_VERSION = "v1"
|
|
|
|
const WORKER_VERSION_HEADER = "morffix-version"
|
|
const SHARED_SECRET_HEADER = "morffix-secret"
|
|
const NAME_HEADER = "morffix-name"
|
|
const UUID_HEADER = "morffix-uuid"
|
|
|
|
const INDEX_TEMPLATE_NAME = "index.tmpl"
|
|
const LIBRARIES_TEMPLATE_NAME = "libraries.tmpl"
|
|
const LIBRARY_TEMPLATE_NAME = "library.tmpl"
|
|
const MESSAGE_TEMPLATE_NAME = "message.tmpl"
|
|
const TASKS_TEMPLATE_NAME = "tasks.tmpl"
|
|
const TASK_TEMPLATE_NAME = "task.tmpl"
|
|
|
|
const (
|
|
TASK_TYPE_HEALTHCHECK = iota
|
|
TASK_TYPE_TRANSCODE
|
|
)
|
|
|
|
type TaskStatus int
|
|
|
|
// Non Append Changes Need Worker Version Bump
|
|
const (
|
|
TASK_STATUS_UNKNOWN TaskStatus = iota
|
|
TASK_STATUS_FAILED
|
|
TASK_STATUS_SUCCESS
|
|
TASK_STATUS_RUNNING
|
|
TASK_STATUS_QUEUED
|
|
TASK_STATUS_ASSIGNED
|
|
TASK_STATUS_PAUSED
|
|
TASK_STATUS_WAITING
|
|
)
|
|
|
|
func (s TaskStatus) String() string {
|
|
switch s {
|
|
case TASK_STATUS_UNKNOWN:
|
|
return "Unknown"
|
|
case TASK_STATUS_FAILED:
|
|
return "Failed"
|
|
case TASK_STATUS_SUCCESS:
|
|
return "Success"
|
|
case TASK_STATUS_RUNNING:
|
|
return "Running"
|
|
case TASK_STATUS_QUEUED:
|
|
return "Queued"
|
|
case TASK_STATUS_ASSIGNED:
|
|
return "Assigned"
|
|
case TASK_STATUS_PAUSED:
|
|
return "Paused"
|
|
case TASK_STATUS_WAITING:
|
|
return "Waiting"
|
|
default:
|
|
return fmt.Sprintf("%d", int(s))
|
|
}
|
|
}
|