task

package
v0.0.0-...-6a817be Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LIMIT_PATH = "C:/"

Variables

View Source
var ABS_LIMIT_PATH string

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Dao Dao
}

func NewController

func NewController(dao Dao) *Controller

func (*Controller) AddTask

func (taskController *Controller) AddTask(taskIn Task)

func (*Controller) GetTaskDetail

func (taskController *Controller) GetTaskDetail(taskView View) Task

func (*Controller) GetTaskHistory

func (taskController *Controller) GetTaskHistory(taskView View) []RunInstance

func (*Controller) GetTasksViews

func (taskController *Controller) GetTasksViews() []View

func (*Controller) RunTask

func (taskController *Controller) RunTask(taskView View, data Data)

type Dao

type Dao interface {
	GetTasksViews() []View
	GetTaskDetail(View) Task
	GetTaskHistory(View) []RunInstance
	AddTask(Task)
	// AddRunInstance(RunInstance)
	AddTaskRun(taskName string, newRunInstance RunInstance)
}

Dao is the interface for all TaskDaos.

type Data

type Data struct {
	FieldNameToValue map[string]string `json:"nameToData"`
}

Data contains the data of a Task. Pretty much the HTTP post info.

type DataHTTP

type DataHTTP struct {
	Data Data `json:"data"`
}

DataHTTP used to wrap Data to be sent as json over the wire.

type MapStoreDao

type MapStoreDao struct {
	Store map[string]*TaskDataRuns
}

This is EXTREMELY not thread safe right now.

func NewMapStoreDao

func NewMapStoreDao() *MapStoreDao

func (*MapStoreDao) AddTask

func (dao *MapStoreDao) AddTask(taskIn Task)

func (*MapStoreDao) AddTaskRun

func (dao *MapStoreDao) AddTaskRun(
	taskName string, newRunInstance RunInstance)

func (*MapStoreDao) GetTaskDetail

func (dao *MapStoreDao) GetTaskDetail(view View) Task

func (*MapStoreDao) GetTaskHistory

func (dao *MapStoreDao) GetTaskHistory(view View) []RunInstance

func (*MapStoreDao) GetTasksViews

func (dao *MapStoreDao) GetTasksViews() []View

GetTasksView returns a small view of all the tasks.

type RunInstance

type RunInstance struct {
	StartTime time.Time
	EndTime   time.Time
	Data      Data
}

RunInstance is used to represent a single instance of a running of a task.

type Schema

type Schema struct {
	// TODO probably need to rethink this.
	FieldNameToDataType map[string]string `json:"nameToType"`
}

Schema is used to represent what data a Task contains.

type Task

type Task struct {
	View
	Schema
	// contains filtered or unexported fields
}

Task is used to represent a task, including schema and data.

func NewTask

func NewTask(id int, name, description string) *Task

NewTask creates a new task with name and description

func (*Task) AddSchemaField

func (taskSelf *Task) AddSchemaField(name, dataType string)

AddSchemaField adds detail to the schema.

func (Task) CopyView

func (taskSelf Task) CopyView() View

CopyView copies the view from the task.

func (*Task) Equals

func (taskSelf *Task) Equals(taskOther *Task) bool

func (*Task) GetTaskCommandString

func (selfTask *Task) GetTaskCommandString() string

func (*Task) Run

func (taskSelf *Task) Run(data Data) bytes.Buffer

Run method runs the task as specified with the data given.

func (*Task) SetTaskProcess

func (selfTask *Task) SetTaskProcess(path string, arguments []string) error

type TaskAndData

type TaskAndData struct {
	Task Task `json:"task"`
	Data Data `json:"data"`
}

TaskAndData is used mostly to retrieve the data from the Post request made.

type TaskDataRuns

type TaskDataRuns struct {
	Task         Task
	RunInstances []RunInstance
}

TaskDataRuns is a struct that contains a task along with its run instances.

type TaskHTTP

type TaskHTTP struct {
	Task       Task   `json:"task"`
	CommandStr string `json:"commandString"`
}

TaskHTTP is a 'task' just wrapped as one field to be used by http to send it as json over the wire.

type View

type View struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

View is used to represent a simple high level view of a Task.

type ViewAndDataHTTP

type ViewAndDataHTTP struct {
	View View `json:"view"`
	Data Data `json:"data"`
}

type ViewHTTP

type ViewHTTP struct {
	View View `json:"view"`
}

type ViewsHTTP

type ViewsHTTP struct {
	Views []View `json:"taskViews"`
}

Jump to

Keyboard shortcuts

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