Documentation ¶
Overview ¶
A persistent task queue server.
This is not a very good implementation, but it should be reliable (the state is kept in the database), and it should be able to handle a large number of queued tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
RemoteError = errors.New("Remote error")
)
Functions ¶
This section is empty.
Types ¶
type StateMachine ¶
type StateMachine struct { Client services.TaskClient Plans map[string]*task_api.Plan Actions map[string]task_api.Action // contains filtered or unexported fields }
StateMachine implements a state machine on top of a TaskClient interface (not directly the TaskClient class in this same package).
func NewStateMachine ¶
func NewStateMachine(tc services.TaskClient, plans map[string]*task_api.Plan, actions map[string]task_api.Action) *StateMachine
func (*StateMachine) Run ¶
func (sm *StateMachine) Run(nWorkers int)
type TaskClient ¶
type TaskClient struct {
// contains filtered or unexported fields
}
func NewTaskClient ¶
func NewTaskClient(addr string, db services.Database) *TaskClient
func NewTaskClientFromConfig ¶
func NewTaskClientFromConfig(db services.Database) *TaskClient
func (*TaskClient) CreateJob ¶
func (t *TaskClient) CreateJob(plan *task_api.Plan, arg string) error
CreateJob creates a new job and puts it in the queue.
func (*TaskClient) GetJob ¶
func (t *TaskClient) GetJob(jobId string) (*task_api.Job, error)
GetJob retrieves a job from persistent storage.
func (*TaskClient) Poll ¶
func (t *TaskClient) Poll(fn func(*task_api.Job))
Poll loops forever, waiting until an event is available, and calling 'fn' with it.
type TaskServer ¶
type TaskServer struct {
// contains filtered or unexported fields
}
func NewTaskServer ¶
func NewTaskServer(db services.Database) *TaskServer
func (*TaskServer) Poll ¶
func (ts *TaskServer) Poll(w http.ResponseWriter, r *http.Request)
func (*TaskServer) Push ¶
func (ts *TaskServer) Push(w http.ResponseWriter, r *http.Request)
func (*TaskServer) RegisterService ¶
func (ts *TaskServer) RegisterService()
Directories ¶
Path | Synopsis |
---|---|
Re-add orphaned tasks to the task_queue.
|
Re-add orphaned tasks to the task_queue. |
Click to show internal directories.
Click to hide internal directories.