Documentation ¶
Index ¶
- Constants
- Variables
- func AppContextMiddleware(app *App) echo.MiddlewareFunc
- func CreateJobHandler(c echo.Context) error
- func DeleteJobHandler(c echo.Context) error
- func ErrorHandler(err error, c echo.Context)
- func GetJobHandler(c echo.Context) error
- func InfoHandler(c echo.Context) error
- func ListJobsHandler(c echo.Context) error
- func NewErrorValidationFailed(msgs ...string) *echo.HTTPError
- func NewHttpErrorNotFound(msgs ...string) *echo.HTTPError
- func RestartJobHandler(c echo.Context) error
- func StatsHandler(c echo.Context) error
- func StopJobHandler(c echo.Context) error
- func UIFallbackHandler(c echo.Context) error
- func UIIndexHandler(c echo.Context) error
- type App
- type AppContext
- type Background
- type Config
- type Dispatcher
- type ErrJobAlreadyExisted
- type ErrJobNotFound
- type J
- type ListJobsQuery
- type QueueManager
- func (m *QueueManager) CancelJob(id uint64) error
- func (m *QueueManager) EnqueueAsync(job *hq.Job)
- func (m *QueueManager) RegisterRunningJob(job *hq.Job, cancel context.CancelFunc)
- func (m *QueueManager) RegisterWaitingJob(job *hq.Job)
- func (m *QueueManager) RemoveRunningJob(job *hq.Job)
- func (m *QueueManager) Start()
- func (m *QueueManager) UpdateJobStatus(job *hq.Job) *hq.Job
- func (m *QueueManager) Wait()
- type RunningJob
- type Store
- func (s *Store) CreateJob(job *hq.Job) error
- func (s *Store) DeleteJob(id uint64) error
- func (s *Store) FetchJob(id uint64, job *hq.Job) error
- func (s *Store) Init() error
- func (s *Store) JobsStats() (*bolt.BucketStats, error)
- func (s *Store) ListJobs(query *ListJobsQuery, ret *hq.JobList) error
- func (s *Store) UpdateJob(job *hq.Job) error
- type Template
- type WaitingJob
Constants ¶
View Source
const (
BucketNameForJobs = "j"
)
Variables ¶
View Source
var (
DefaultJobName = "default"
)
View Source
var (
WorkerDefaultUserAgent = fmt.Sprintf("%s/%s", hq.DisplayName, hq.Version)
)
Functions ¶
func AppContextMiddleware ¶
func AppContextMiddleware(app *App) echo.MiddlewareFunc
func CreateJobHandler ¶
func DeleteJobHandler ¶
func ErrorHandler ¶
func GetJobHandler ¶
func InfoHandler ¶
func ListJobsHandler ¶
func NewErrorValidationFailed ¶
NewErrorResponseWithValidatorReport creates new error response with ValidationReport.
func NewHttpErrorNotFound ¶
func RestartJobHandler ¶
func StatsHandler ¶
func StopJobHandler ¶
func UIFallbackHandler ¶
func UIIndexHandler ¶
Types ¶
type App ¶
type App struct { // Configuration of the application instance Config *Config // Logger Logger echo.Logger // LogfileWriter LogfileWriter reopen.Writer // LogLevel LogLevel log.Lvl // Echo web framework Echo *echo.Echo // AccessLog AccessLogFile *os.File // AccessLogFile AccessLogFileWriter reopen.Writer // DataDir DataDir string // UseTempDataDir UseTempDataDir bool // DB DB *bolt.DB // Store Store *Store // Background Background *Background // katsubushi Gen katsubushi.Generator // QueueManager QueueManager *QueueManager }
func (*App) BoltDBPath ¶
func (*App) ListenAndServe ¶
type AppContext ¶
func (*AppContext) App ¶
func (c *AppContext) App() *App
type Background ¶
type Background struct {
// contains filtered or unexported fields
}
func NewBackground ¶
func NewBackground(app *App) *Background
func (*Background) Close ¶
func (bg *Background) Close()
func (*Background) Start ¶
func (bg *Background) Start()
type Config ¶
type Config struct { ServerId uint `toml:"server_id"` LogLevel string `toml:"log_level"` Addr string `toml:"addr"` Logfile string `toml:"log_file"` DataDir string `toml:"data_dir"` AccessLogfile string `toml:"access_log_file"` Queues int64 `toml:"queues"` Dispatchers int64 `toml:"dispatchers"` MaxWorkers int64 `toml:"max_workers"` ShutdownTimeout int64 `toml:"shutdown_timeout"` JobLifetime int64 `toml:"job_lifetime"` JobListDefaultLimit int `toml:"job_list_default_limit"` UI bool `toml:"ui"` UIBasename string `toml:"ui_basename"` IDEpoch []int `toml:"id_epoch"` }
func (*Config) LoadConfigFile ¶
func (*Config) SetLogLevel ¶
type Dispatcher ¶
type Dispatcher struct { NumWorkers int64 // contains filtered or unexported fields }
type ErrJobAlreadyExisted ¶
func (*ErrJobAlreadyExisted) Error ¶
func (e *ErrJobAlreadyExisted) Error() string
type ErrJobNotFound ¶
type ErrJobNotFound struct {
ID uint64
}
func (*ErrJobNotFound) Error ¶
func (e *ErrJobNotFound) Error() string
type J ¶
type J struct { ID uint64 Name string Comment string URL string Payload json.RawMessage Headers map[string]string Timeout int64 CreatedAt time.Time StartedAt *time.Time FinishedAt *time.Time Failure bool Success bool Canceled bool StatusCode *int Err string Output string }
J is internal representation of a job in the boltdb.
type ListJobsQuery ¶
type QueueManager ¶
type QueueManager struct { App *App Queue chan *hq.Job Dispatchers []*Dispatcher WorkerWg *sync.WaitGroup WaitingJobs map[uint64]*WaitingJob RunningJobs map[uint64]*RunningJob // contains filtered or unexported fields }
func NewQueueManager ¶
func NewQueueManager(app *App) *QueueManager
func (*QueueManager) CancelJob ¶
func (m *QueueManager) CancelJob(id uint64) error
func (*QueueManager) EnqueueAsync ¶
func (m *QueueManager) EnqueueAsync(job *hq.Job)
func (*QueueManager) RegisterRunningJob ¶
func (m *QueueManager) RegisterRunningJob(job *hq.Job, cancel context.CancelFunc)
func (*QueueManager) RegisterWaitingJob ¶
func (m *QueueManager) RegisterWaitingJob(job *hq.Job)
func (*QueueManager) RemoveRunningJob ¶
func (m *QueueManager) RemoveRunningJob(job *hq.Job)
func (*QueueManager) Start ¶
func (m *QueueManager) Start()
func (*QueueManager) UpdateJobStatus ¶
func (m *QueueManager) UpdateJobStatus(job *hq.Job) *hq.Job
func (*QueueManager) Wait ¶
func (m *QueueManager) Wait()
type RunningJob ¶
type RunningJob struct { Job *hq.Job Cancel context.CancelFunc }
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
type WaitingJob ¶
Click to show internal directories.
Click to hide internal directories.