Documentation ¶
Index ¶
- Constants
- Variables
- func JobResp(rec *job.RunRecord, j *job.Job) []byte
- func QueueResp(name string, insp *job.Inspector) []byte
- type AddHandler
- type CompleteHandler
- type DeleteHandler
- type FailHandler
- type Handler
- type InspectHandler
- type InspectJobHandler
- type InspectJobsHandler
- type InspectQueueHandler
- type InspectQueuesHandler
- type InspectServerHandler
- type JobStater
- type LeaseHandler
- type ResultHandler
- type RunHandler
- type ScheduleHandler
- type ServerStater
- type UnknownHandler
Constants ¶
const (
MaxLimit = 100
)
Variables ¶
var ( ErrDuplicateJob = prot.NewClientErr(job.ErrDuplicateJob.Error()) ErrLeaseExpired = prot.NewClientErr("Lease expired") ErrInvalidWaitTimeout = prot.NewClientErr("Invalid wait timeout") )
var ( ErrInvalidCursorOffset = prot.NewClientErr("Invalid cursor offset") ErrInvalidLimit = prot.NewClientErr("Invalid limit") )
Functions ¶
Types ¶
type AddHandler ¶
type AddHandler struct {
// contains filtered or unexported fields
}
func NewAddHandler ¶
func NewAddHandler(jc job.Adder) *AddHandler
func (*AddHandler) Exec ¶
func (h *AddHandler) Exec(cmd *prot.Cmd) ([]byte, error)
add <id> <name> <ttr> <ttl> <payload-size> [max-attempts=<value>] [max-fails=<value>] [-priority=<value>] <payload>
Adds a job to its named work queue with respect for <priority> TTL timer starts immmediately
Returns: CLIENT-ERROR on invalid input OK on success enqueue
type CompleteHandler ¶
type CompleteHandler struct {
// contains filtered or unexported fields
}
func NewCompleteHandler ¶
func NewCompleteHandler(jc job.Completer) *CompleteHandler
type DeleteHandler ¶
type DeleteHandler struct {
// contains filtered or unexported fields
}
func NewDeleteHandler ¶
func NewDeleteHandler(jc job.Deleter) *DeleteHandler
type FailHandler ¶
type FailHandler struct {
// contains filtered or unexported fields
}
func NewFailHandler ¶
func NewFailHandler(jc job.Failer) *FailHandler
type InspectHandler ¶
type InspectHandler struct {
// contains filtered or unexported fields
}
Primary Inspect Handler acts as a router to other sub inspect cmds
func NewInspectHandler ¶
type InspectJobHandler ¶
type InspectJobHandler struct {
// contains filtered or unexported fields
}
func NewInspectJobHandler ¶
func NewInspectJobHandler(reg *job.Registry) *InspectJobHandler
type InspectJobsHandler ¶
type InspectJobsHandler struct {
// contains filtered or unexported fields
}
func NewInspectJobsHandler ¶
func NewInspectJobsHandler(reg *job.Registry, qc job.QueueControllerInterface) *InspectJobsHandler
func (*InspectJobsHandler) Exec ¶
func (h *InspectJobsHandler) Exec(cmd *prot.Cmd) ([]byte, error)
inspect jobs <name> <cursor-offset> <limit> & inspect scheduled-jobs <name> <cursor-offset> <limit>
Scan jobs by name with a cursor-offset and limit. <jobs> returns in priority,created-time order. <scheduled-jobs> returns in scheduled time, priority,created-time order.
Returns: CLIENT-ERROR in invalid input
type InspectQueueHandler ¶
type InspectQueueHandler struct {
// contains filtered or unexported fields
}
func NewInspectQueueHandler ¶
func NewInspectQueueHandler(qc job.QueueControllerInterface) *InspectQueueHandler
type InspectQueuesHandler ¶
type InspectQueuesHandler struct {
// contains filtered or unexported fields
}
func NewInspectQueuesHandler ¶
func NewInspectQueuesHandler(qc job.QueueControllerInterface) *InspectQueuesHandler
func (*InspectQueuesHandler) Exec ¶
func (h *InspectQueuesHandler) Exec(cmd *prot.Cmd) ([]byte, error)
Inspect queues <cursor-offset> <limit>
Scan available queues based on a cursor-offset and limit. Returns queues in aplhabetical order.
Returns: CLIENT-ERROR on invalid input NOT-FOUND when queue is not available
type InspectServerHandler ¶
type InspectServerHandler struct {
// contains filtered or unexported fields
}
func NewInspectServerHandler ¶
func NewInspectServerHandler(s ServerStater, j JobStater) *InspectServerHandler
type LeaseHandler ¶
type LeaseHandler struct {
// contains filtered or unexported fields
}
func NewLeaseHandler ¶
func NewLeaseHandler(jc job.Leaser) *LeaseHandler
func (*LeaseHandler) Exec ¶
func (h *LeaseHandler) Exec(cmd *prot.Cmd) ([]byte, error)
lease <name>... <wait-timeout>
Lease a job by name blocking until wait-timeout. Multiple job names can be specified and they will be processed uniformly by random selection.
Returns:
CLIENT-ERROR * on invalid input. TIMEOUT if no jobs were available within <wait-timeout>. OK if successful with leased job response.
type ResultHandler ¶
type ResultHandler struct {
// contains filtered or unexported fields
}
func NewResultHandler ¶
func NewResultHandler(reg *job.Registry, qc job.QueueControllerInterface) *ResultHandler
type RunHandler ¶
type RunHandler struct {
// contains filtered or unexported fields
}
func NewRunHandler ¶
func NewRunHandler(jc job.Runner) *RunHandler
func (*RunHandler) Exec ¶
func (h *RunHandler) Exec(cmd *prot.Cmd) ([]byte, error)
run <id> <name> <ttr> <wait-timeout> <payload-size> [-priority=<value>] <payload-bytes>
Run a job, blocking until wait-timeout if no workers are available, or until TTR if a worker is processing.
Returns:
CLIENT-ERROR on invalid input TIMEOUT if no workers were available within <wait-timeout> OK if successful with result response of executed job.
type ScheduleHandler ¶
type ScheduleHandler struct {
// contains filtered or unexported fields
}
func NewScheduleHandler ¶
func NewScheduleHandler(jc job.Scheduler) *ScheduleHandler
func (*ScheduleHandler) Exec ¶
func (h *ScheduleHandler) Exec(cmd *prot.Cmd) ([]byte, error)
schedule <id> <name> <ttr> <ttl> <time> <payload-size> [max-attempts=<value>] [max-fails=<value>] [-priority=<value>] <payload>
Schedules a job to run at a UTC time with respect for <priority> TTL timer starts when scheduled time is met.
Returns: CLIENT-ERROR on invalid input OK on success enqueue
type ServerStater ¶
type UnknownHandler ¶
type UnknownHandler struct{}