task

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: GPL-2.0, GPL-3.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTask

func AddTask(task *Task) error

AddTask registers a new task into the system

func RemoveTask

func RemoveTask(task *Task) error

RemoveTask removes a task from the application

func Update

func Update(task *Task) error

Update updates the task

Types

type Identifier

type Identifier interface {
	ID() string
}

Identifier is a interface for units that have a unique identifier

type Task

type Task struct {
	UUID    string                `json:"uuid"`
	Name    string                `json:"name"`
	Event   *event.Proxy          `json:"event"`
	Actions []*unit.Unit          `json:"actions"`
	Queue   chan types.TupleSpace `json:"-"`
	// contains filtered or unexported fields
}

Task is an object that processes data based on events, converters and actions

func All

func All() []*Task

All return all registered tasks in a list

func GetTaskByID

func GetTaskByID(id string) (*Task, error)

GetTaskByID returns the task among the registered tasks where the id matches

func GetTaskByName

func GetTaskByName(name string) (task *Task, err error)

GetTaskByName retrieves a task by its name

func New

func New(actions ...*unit.Unit) *Task

New creates a new task from actions

func (*Task) GenerateUUID

func (t *Task) GenerateUUID()

GenerateUUID genereates a new id for the task

func (*Task) GetUnitByName

func (t *Task) GetUnitByName(name string) (unit *unit.Unit, err error)

GetUnitByName retrieves a unit in the actions list and returns it

func (*Task) ID

func (t *Task) ID() string

ID returns the unique identifier to the task

func (*Task) Run

func (t *Task) Run(ts types.TupleSpace) error

Run starts the task

func (*Task) SetEvent

func (t *Task) SetEvent(e *event.Event)

SetEvent sets a new event for the task

func (*Task) Subscribe

func (t *Task) Subscribe() error

Subscribe subscribes the task to its event

func (*Task) UnmarshalJSON

func (t *Task) UnmarshalJSON(data []byte) error

UnmarshalJSON for JSON serialization

func (*Task) Unsubscribe

func (t *Task) Unsubscribe() error

Unsubscribe removed this task as an observer for its event

func (*Task) Validate

func (t *Task) Validate() error

Validate validates the task

Jump to

Keyboard shortcuts

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