Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client - Dips client instance
func (*Client) NewEventHandler ¶
func (c *Client) NewEventHandler() *EventHandler
func (*Client) NewJobWorker ¶
func (*Client) NewTaskWorker ¶
func (client *Client) NewTaskWorker(service string) *TaskWorker
NewWorker - Creates a new worker service with the given name
type DispatchedTask ¶
type DispatchedTask struct {
// contains filtered or unexported fields
}
A task that has been dispatched to a worker that awaits a response
func (*DispatchedTask) Await ¶
func (t *DispatchedTask) Await() (*TaskResult, error)
func (*DispatchedTask) Close ¶
func (t *DispatchedTask) Close()
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
The event to be dispatched
func (*Event) Message ¶
func (e *Event) Message(message *MessageEvent) *Event
func (*Event) Status ¶
func (e *Event) Status(status *StatusEvent) *Event
func (*Event) Variable ¶
func (e *Event) Variable(variable *VariableEvent) *Event
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func (*EventHandler) HandleMessage ¶
func (h *EventHandler) HandleMessage(message func(*MessageEvent) error) *EventHandler
func (*EventHandler) HandleStatus ¶
func (h *EventHandler) HandleStatus(status func(*StatusEvent) error) *EventHandler
func (*EventHandler) HandleVariable ¶
func (h *EventHandler) HandleVariable(variable func(*VariableEvent) error) *EventHandler
func (*EventHandler) Run ¶
func (h *EventHandler) Run()
Run - Starts a new goroutine for this event handler
type JobContext ¶
type JobContext struct { Client *Client Worker *JobWorker Request *JobRequest }
type JobRequest ¶
type JobWorker ¶
type JobWorker struct {
// contains filtered or unexported fields
}
func (*JobWorker) Concurrency ¶
type MessageEvent ¶
type MessageEvent struct { JobId string TaskId string Type MessageEventType Message string }
type MessageEventType ¶
type MessageEventType uint
the type of the message
const ( LogDebugMessage MessageEventType = 0 LogInfoMessage MessageEventType = 1 LogWarnMessage MessageEventType = 2 LogErrorMessage MessageEventType = 3 LogCritMessage MessageEventType = 4 StdOutMessage MessageEventType = 10 StdErrMessage MessageEventType = 11 )
type StatusEvent ¶
type StatusEvent struct { JobId string TaskId string Type StatusEventType Progress uint }
type StatusEventType ¶
type StatusEventType uint
the type of the job status update
const ( // progress update ProgressEvent StatusEventType = 1 )
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task - A task instance to be dispatched to a worker
func (*Task) Dispatch ¶
func (t *Task) Dispatch() *DispatchedTask
Dispatches the task (and never blocks)
func (*Task) Parameters ¶
Parameters - Sets the input parameters of the task
type TaskContext ¶
type TaskContext struct { Client *Client Request *TaskRequest // TODO: configurable environment / filesystem? Filesystem taskfs.FileSystem Environment taskenv.Environment }
TaskContext - The TaskContext that is being sent to the task handler
type TaskRequest ¶
type TaskRequest struct { TaskID string `json:"id" bson:"id"` Timeout time.Duration `json:"timeout" bson:"timeout"` Job *model.Job `json:"job" bson:"job"` Name string `json:"name" bson:"name"` Params map[string]string `json:"params" bson:"params"` }
TaskRequest - Request to start a task
type TaskResult ¶
type TaskWorker ¶
type TaskWorker struct {
// contains filtered or unexported fields
}
TaskWorker - A worker service instance
func (*TaskWorker) Concurrency ¶
func (w *TaskWorker) Concurrency(threads int) *TaskWorker
func (*TaskWorker) Filesystem ¶
func (w *TaskWorker) Filesystem(filesystem string) *TaskWorker
func (*TaskWorker) Handler ¶
func (w *TaskWorker) Handler(handler func(*TaskContext) (map[string]interface{}, error)) *TaskWorker
Handler - Sets the handler for this worker
func (*TaskWorker) Run ¶
func (worker *TaskWorker) Run()
Run - Starts a new goroutine for this worker
type VariableEvent ¶
type VariableEvent struct { Name string `json:"name"` Value interface{} `json:"value"` }