Documentation ¶
Index ¶
- Variables
- type Service
- type Task
- type TaskManager
- func (tm *TaskManager) Check(name string) []error
- func (tm *TaskManager) New(name string, taskFunc TaskRunFunc) error
- func (tm *TaskManager) Run(name string, args ...interface{}) (chan error, error)
- func (tm *TaskManager) RunTask(task Task, args ...interface{}) (string, chan error, error)
- func (tm *TaskManager) Shutdown()
- type TaskRunFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidName = errors.New("name cannot be blank or all spaces") ErrAlreadyExists = errors.New("task with that name already exists") ErrTaskNotFound = errors.New("task with supplied name not found") ErrNotActive = errors.New("task manager has been shutdown") )
Errors
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service interface { // New adds a stored task to the manager New(name string, taskFunc TaskRunFunc) error // Check takes a task name and checks to see if there are any errors from that task Check(name string) []error // Run takes a task name and runs it with supplied args Run(name string, args ...interface{}) (chan error, error) // RunTask takes a Task and queues it to run RunTask(task Task) (string, chan error, error) // Shutdown stops the service Shutdown() error }
Service is the interface that provides auth methods.
type Task ¶
type Task struct { Name string Func TaskRunFunc Errs []error ErrChan chan error Quit chan struct{} }
Task model represents each task in the system
type TaskManager ¶
TaskManager is the core of the taskman service it is responsible for running tasks
func NewTaskManager ¶
func NewTaskManager() (tm *TaskManager)
NewTaskManager initializes a new TaskMan service and returns the instance of it
func (*TaskManager) Check ¶
func (tm *TaskManager) Check(name string) []error
Check takes a task name and checks to see if there are any errors from that task
func (*TaskManager) New ¶
func (tm *TaskManager) New(name string, taskFunc TaskRunFunc) error
New adds a stored task to the manager
func (*TaskManager) Run ¶
func (tm *TaskManager) Run(name string, args ...interface{}) (chan error, error)
Run takes a task name and runs it with supplied args
func (*TaskManager) RunTask ¶
func (tm *TaskManager) RunTask(task Task, args ...interface{}) (string, chan error, error)
RunTask takes a task and runs it
func (*TaskManager) Shutdown ¶
func (tm *TaskManager) Shutdown()
Shutdown stops task processing sends "quit" to all tasks as well (for long running tasks)
type TaskRunFunc ¶
type TaskRunFunc func(args ...interface{}) error
TaskRunFunc is the function that is run
Click to show internal directories.
Click to hide internal directories.