Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // Start to serve Start() error // Register multiple jobs. // // jobs map[string]interface{}: job map, key is job name and value is job handler. // // Return: // error if failed to register RegisterJobs(jobs map[string]interface{}) error // Enqueue job // // jobName string : the name of enqueuing job // params job.Parameters : parameters of enqueuing job // isUnique bool : specify if duplicated job will be discarded // webHook string : the server URL to receive hook events // // Returns: // *job.Stats : the stats of enqueuing job if succeed // error : if failed to enqueue Enqueue(jobName string, params job.Parameters, isUnique bool, webHook string) (*job.Stats, error) // Schedule job to run after the specified interval (seconds). // // jobName string : the name of enqueuing job // runAfterSeconds uint64 : the waiting interval with seconds // params job.Parameters : parameters of enqueuing job // isUnique bool : specify if duplicated job will be discarded // webHook string : the server URL to receive hook events // // Returns: // *job.Stats: the stats of enqueuing job if succeed // error : if failed to enqueue Schedule(jobName string, params job.Parameters, runAfterSeconds uint64, isUnique bool, webHook string) (*job.Stats, error) // Schedule the job periodically running. // // jobName string : the name of enqueuing job // params job.Parameters : parameters of enqueuing job // cronSetting string : the periodic duration with cron style like '0 * * * * *' // isUnique bool : specify if duplicated job will be discarded // webHook string : the server URL to receive hook events // // Returns: // models.JobStats: the stats of enqueuing job if succeed // error : if failed to enqueue PeriodicallyEnqueue(jobName string, params job.Parameters, cronSetting string, isUnique bool, webHook string) (*job.Stats, error) // Return the status info of the worker. // // Returns: // *Stats : the stats info of all running pools // error : failed to check Stats() (*Stats, error) // Check if the job has been already registered. // // name string : name of job // // Returns: // interface{} : the job type of the known job if it's existing // bool : if the known job requires parameters IsKnownJob(name string) (interface{}, bool) ValidateJobParameters(jobType interface{}, params job.Parameters) error // Stop the job // // jobID string : ID of the enqueued job // // Return: // error : error returned if meet any problems StopJob(jobID string) error // Retry the job // // jobID string : ID of the enqueued job // // Return: // error : error returned if meet any problems RetryJob(jobID string) error }
Interface for worker. More like a driver to transparent the lower queue.
type Stats ¶
type Stats struct {
Pools []*StatsData `json:"worker_pools"`
}
Stats represents the healthy and status of all the running worker pools.
type StatsData ¶
type StatsData struct { WorkerPoolID string `json:"worker_pool_id"` StartedAt int64 `json:"started_at"` HeartbeatAt int64 `json:"heartbeat_at"` JobNames []string `json:"job_names"` Concurrency uint `json:"concurrency"` Status string `json:"status"` }
StatsData represents the healthy and status of the worker worker.
Click to show internal directories.
Click to hide internal directories.