Documentation
¶
Index ¶
- func NewExistingGormClient(db *gorm.DB, config jobinator.ClientConfig) (*jobinator.Client, error)
- func NewGormClient(dbtype string, dbconn string, config jobinator.ClientConfig) (*jobinator.Client, error)
- type GormClient
- func (c *GormClient) GetNamedJob(name string) (*jobinator.Job, error)
- func (c *GormClient) IncRetryCount(j *jobinator.Job) error
- func (c *GormClient) InternalCleanup(config jobinator.CleanUpConfig) error
- func (c *GormClient) InternalEnqueueJob(j *jobinator.Job) error
- func (c *GormClient) InternalPendingJobs() ([]*jobinator.Job, error)
- func (c *GormClient) InternalRegisterWorker(name string, wf jobinator.WorkerFunc)
- func (c *GormClient) InternalSelectJob() (*jobinator.Job, error)
- func (c *GormClient) SetError(j *jobinator.Job, errtxt string, stack string) error
- func (c *GormClient) SetFinishedAt(j *jobinator.Job, t int64) error
- func (c *GormClient) SetNextRun(j *jobinator.Job, t int64) error
- func (c *GormClient) SetStatus(j *jobinator.Job, status int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExistingGormClient ¶
NewExistingGormClient is like NewGormClient(), except instead of adding connection params, it uses an existing gorm handle.
func NewGormClient ¶
func NewGormClient(dbtype string, dbconn string, config jobinator.ClientConfig) (*jobinator.Client, error)
NewGormClient returns a new *Client backed by gorm. It requires a driver type and connection string, as well as a ClientConfig.
Types ¶
type GormClient ¶
type GormClient struct {
// contains filtered or unexported fields
}
GormClient represents a client using a Gorm backend (SQL)
func (*GormClient) GetNamedJob ¶
func (c *GormClient) GetNamedJob(name string) (*jobinator.Job, error)
func (*GormClient) IncRetryCount ¶
func (c *GormClient) IncRetryCount(j *jobinator.Job) error
IncRetryCount increments the retry count for the job
func (*GormClient) InternalCleanup ¶
func (c *GormClient) InternalCleanup(config jobinator.CleanUpConfig) error
InternalCleanup deletes all jobs that have been finished (or optionally failed jobs) older than specified in the CleanUpConfig
func (*GormClient) InternalEnqueueJob ¶
func (c *GormClient) InternalEnqueueJob(j *jobinator.Job) error
InternalEnqueueJob queues up a job.
func (*GormClient) InternalPendingJobs ¶
func (c *GormClient) InternalPendingJobs() ([]*jobinator.Job, error)
InternalPendingJobs returns all pending jobs
func (*GormClient) InternalRegisterWorker ¶
func (c *GormClient) InternalRegisterWorker(name string, wf jobinator.WorkerFunc)
InternalRegisterWorker adds a worker to the list of registered workers for the internal client. This allows it to determine which jobs this node can execute.
func (*GormClient) InternalSelectJob ¶
func (c *GormClient) InternalSelectJob() (*jobinator.Job, error)
InternalSelectJob selects a job from the database and marks it as in progress.
func (*GormClient) SetError ¶
SetError sets the error and stacktrace on the job, usually occurring before a retry.
func (*GormClient) SetFinishedAt ¶
func (c *GormClient) SetFinishedAt(j *jobinator.Job, t int64) error
SetFinishedAt marks the time that the job finished at
func (*GormClient) SetNextRun ¶
func (c *GormClient) SetNextRun(j *jobinator.Job, t int64) error
SetNextRun updates the next run field of the job