gormclient

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExistingGormClient

func NewExistingGormClient(db *gorm.DB, config jobinator.ClientConfig) (*jobinator.Client, error)

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

func (c *GormClient) SetError(j *jobinator.Job, errtxt string, stack string) error

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

func (*GormClient) SetStatus

func (c *GormClient) SetStatus(j *jobinator.Job, status int) error

SetStatus sets the status for the job. See jobinator/status package for more info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL