Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueuesToHandles ¶
type QueuesToHandles map[string]TaskHandler
type TaskHandle ¶
func (*TaskHandle) IsUnclaimed ¶
func (h *TaskHandle) IsUnclaimed() bool
func (*TaskHandle) ReportIn ¶
func (h *TaskHandle) ReportIn(data *map[string]interface{}) error
Submit a report with optional data to prevent the task from timing out
func (*TaskHandle) Unclaim ¶
func (h *TaskHandle) Unclaim() error
Unclaims the current task and puts it back on the queue
type TaskHandler ¶
type TaskHandler interface {
Handle(handle TaskHandle) (*Success, *Failure)
}
A Handler taks a TaskHandle and performs a function on it; the handle can be used to report on a given task (also bumps the timeout), unclaim the task (causes ignoring of the return values), or completed as either a success or failure.
type WorkLoop ¶
type WorkLoop struct {
// contains filtered or unexported fields
}
A work loop that submits Task claim requests to the server based on Queues and the Handlers that are interested in the Tasks from each Queue. Run() the returned loop to begin processing.
The claim is submitted as a single request to save bandwidth, and then demuxed to the handlers
func NewWorkLoop ¶
func NewWorkLoop(config config.TasquesWorker, queuesToHandles QueuesToHandles) WorkLoop