Documentation ¶
Index ¶
- Constants
- func CreateJobDB(db *sql.DB) (err error)
- func ServeQueue(baseURL string, q *TaskQueue) http.Handler
- type CommandTask
- type Config
- type Job
- type JobStore
- type LifeCycle
- type MemoryStore
- func (s *MemoryStore) GetJob(uuid string) (job *Job, err error)
- func (s *MemoryStore) GetJobs() ([]*Job, error)
- func (s *MemoryStore) SetResult(uuid string, result interface{}) (err error)
- func (s *MemoryStore) SetStatus(uuid string, status string, updated time.Time) (err error)
- func (s *MemoryStore) Start() (err error)
- func (s *MemoryStore) Stop()
- func (s *MemoryStore) Store(job *Job) error
- type Migration
- type MigrationFn
- type Migrations
- type NameRef
- type Runner
- type SQLRow
- type SQLiteStore
- func (s *SQLiteStore) GetJob(uuid string) (*Job, error)
- func (s *SQLiteStore) GetJobs() (jobs []*Job, err error)
- func (s *SQLiteStore) SetResult(uuid string, result interface{}) (err error)
- func (s *SQLiteStore) SetStatus(uuid string, status string, updated time.Time) (err error)
- func (s *SQLiteStore) Start() (err error)
- func (s *SQLiteStore) Stop()
- func (s *SQLiteStore) Store(job *Job) (err error)
- type TaskQueue
- func (q *TaskQueue) Define(name string, r Runner)
- func (q *TaskQueue) GetJob(uuid string) (*Job, error)
- func (q *TaskQueue) GetJobs() (jobs []*Job, err error)
- func (q *TaskQueue) Start() (err error)
- func (q *TaskQueue) Stop()
- func (q *TaskQueue) Submit(name string, arguments interface{}) (job *Job, err error)
- type WebJob
Constants ¶
View Source
const ( JOB_PENDING = "PENDING" JOB_RUNNING = "RUNNING" JOB_SUCCESS = "SUCCESS" JOB_FAILURE = "FAILURE" )
Variables ¶
This section is empty.
Functions ¶
func CreateJobDB ¶
Types ¶
type CommandTask ¶
func NewCommandTask ¶
func NewCommandTask(Cmd string, Args ...string) CommandTask
func (*CommandTask) Run ¶
func (t *CommandTask) Run(arguments interface{}) (data interface{}, err error)
type Config ¶
var DefaultConfig Config = Config{ QueueLength: 10, JobStore: NewMemoryStore(), }
type Job ¶
type Job struct { UUID string `json:"uuid"` Name string `json:"name"` Status string `json:"status"` Arguments interface{} `json:"arguments"` Result interface{} `json:"result"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` }
func (*Job) HasFinished ¶
type JobStore ¶
type JobStore interface { LifeCycle Store(job *Job) error GetJob(uuid string) (*Job, error) SetStatus(uuid string, status string, updated time.Time) error SetResult(uuid string, result interface{}) error GetJobs() ([]*Job, error) }
func NewMemoryStore ¶
func NewMemoryStore() JobStore
func NewSQLiteStore ¶
func NewSQLiteStore() JobStore
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func (*MemoryStore) GetJobs ¶
func (s *MemoryStore) GetJobs() ([]*Job, error)
func (*MemoryStore) SetResult ¶
func (s *MemoryStore) SetResult(uuid string, result interface{}) (err error)
func (*MemoryStore) Start ¶
func (s *MemoryStore) Start() (err error)
func (*MemoryStore) Stop ¶
func (s *MemoryStore) Stop()
func (*MemoryStore) Store ¶
func (s *MemoryStore) Store(job *Job) error
type MigrationFn ¶
type Migrations ¶
type Migrations struct {
// contains filtered or unexported fields
}
func NewMigrations ¶
func NewMigrations(db *sql.DB) *Migrations
func (*Migrations) Register ¶
func (ms *Migrations) Register(version string, migration MigrationFn)
func (*Migrations) Run ¶
func (ms *Migrations) Run() (err error)
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func (*SQLiteStore) GetJobs ¶
func (s *SQLiteStore) GetJobs() (jobs []*Job, err error)
func (*SQLiteStore) SetResult ¶
func (s *SQLiteStore) SetResult(uuid string, result interface{}) (err error)
func (*SQLiteStore) Start ¶
func (s *SQLiteStore) Start() (err error)
func (*SQLiteStore) Stop ¶
func (s *SQLiteStore) Stop()
func (*SQLiteStore) Store ¶
func (s *SQLiteStore) Store(job *Job) (err error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.