Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTask means a task had a non-zero exit code ErrTask = errors.New("error running a task") )
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context tracks the path of where we store the queues. It is the only structure which knows about how the queues are persisted to disk. It should be promoted to an interface, probably.
func NewContext ¶
NewContext creates a new context structure. taskpath is used to resolve task names into commands.
type Job ¶
type Job struct { Todo []string // FIFO list of task names to execute Finished []Task // list of finished tasks, from earliest to latest // contains filtered or unexported fields }
Job collects all the logical consists of a single processing job. It is, essentially, a list of tasks.
type JobSource ¶
type JobSource interface { // Perform any initializations Init() error // Return the next available job. Block until one is available. // May return a job AND an error, in which case the job should be finalized. NextJob() (*Job, error) // Save and finalize the given job FinishJob(job *Job) error }
A JobSource abstracts the way the main processor gets jobs.
func NewFileQueue ¶
NewFileQueue creates a new FileQueue JobSource having its state directories at basepath.
type State ¶
type State int
State encodes the processing status of a Job.
const ( // StateUnknown is the "zero state" StateUnknown State = iota // StateQueue means job is awaiting processing StateQueue // StateProcessing means job is being processed StateProcessing // StateSuccess means job is finished and was successful StateSuccess // StateError means job is done being processed and there was an error StateError )
Click to show internal directories.
Click to hide internal directories.