project

package
v0.0.0-...-1a2a7be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2017 License: GPL-3.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknown          = errors.New("project unknown error")
	ErrOwnerNotFound    = errors.New("owner not found")
	ErrExecutorNotFound = errors.New("executor not found")
	ErrProjectNotFound  = errors.New("project not found")
	ErrTaskNotFound     = errors.New("task not found")

	ErrNotReadyTask   = errors.New("ready task not found")
	ErrNotRunningTask = errors.New("running task not found")

	ErrTaskNotRunning = errors.New("can't change to stop or error for not running task")
)
View Source
var TaskStatus_name = map[int]string{
	0: "unknown",
	1: "error",
	2: "prepare",
	3: "ready",
	4: "running",
	5: "stop",
}
View Source
var TaskStatus_value = map[string]int{
	"unknown": 0,
	"error":   1,
	"prepare": 2,
	"ready":   3,
	"running": 4,
	"stop":    5,
}

Functions

This section is empty.

Types

type Executor

type Executor struct {
	ID      ExecutorID
	OwnerID user.UserID
	Name    string
	Pack    string
	Data    []byte
}

func NewExecutor

func NewExecutor(ownerID user.UserID, name string, pack string, data []byte) *Executor

type ExecutorID

type ExecutorID string

func (ExecutorID) String

func (id ExecutorID) String() string

type Project

type Project struct {
	ID      ProjectID
	OwnerID user.UserID
	Name    string
	Tasks   []*Task
}

func NewProject

func NewProject(ownerID user.UserID, name string) *Project

type ProjectID

type ProjectID string

func (ProjectID) String

func (id ProjectID) String() string

type Repository

type Repository interface {
	CreateExecutor(*Executor) (*Executor, error)
	DeleteExecutorByID(id ExecutorID) error
	GetExecutorByID(id ExecutorID) (*Executor, error)
	ListExecutors(id user.UserID) ([]*Executor, error)
	CreateProject(*Project) (*Project, error)
	DeleteProjectByID(id ProjectID) error
	GetProjectByID(id ProjectID) (*Project, error)
	ListProjects(id user.UserID) ([]*Project, error)
	CreateTask(task *Task) (*Task, error)
	DeleteTaskByID(id TaskID) error
	GetTaskByID(id TaskID) (*Task, error)
	ListTasksByProjectID(projID ProjectID) ([]*Task, error)
	UpdateTaskByID(id TaskID, task *Task) (*Task, error)
	PopReadyTask() (*Task, error)
}

type Task

type Task struct {
	ID         TaskID
	ProjectID  ProjectID
	ExecutorID ExecutorID
	Name       string
	Status     TaskStatus
	Data       []byte
}

func NewTask

func NewTask(projID ProjectID, execID ExecutorID, name string, data []byte) *Task

type TaskID

type TaskID string

func (TaskID) String

func (id TaskID) String() string

type TaskStatus

type TaskStatus int
const (
	TaskStatus_Unknown TaskStatus = 0
	TaskStatus_Error   TaskStatus = 1
	TaskStatus_Prepare TaskStatus = 2
	TaskStatus_Ready   TaskStatus = 3
	TaskStatus_Running TaskStatus = 4
	TaskStatus_Stop    TaskStatus = 5
)

func LookupTaskStatus

func LookupTaskStatus(s string) TaskStatus

func (TaskStatus) String

func (x TaskStatus) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL