mysql

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID               string
	Topic            string
	State            string
	Args             sql.NullString
	Rank             int
	Priority         int64
	Retry            int
	MaxRetry         int
	CorrelationGroup sql.NullString
	CorrelationID    sql.NullString
	Created          int64
	Started          int64
	Completed        int64
	LastMod          int64
}

func (*Job) ToJob

func (j *Job) ToJob() (*jobqueue.Job, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store represents a persistent MySQL storage implementation. It implements the jobqueue.Store interface.

func NewStore

func NewStore(url string, options ...StoreOption) (*Store, error)

NewStore initializes a new MySQL-based storage.

func NewStoreWithDb added in v1.1.3

func NewStoreWithDb(db *sql.DB, options ...StoreOption) (*Store, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, job *jobqueue.Job) error

Create adds a new job to the store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, job *jobqueue.Job) error

Delete removes a job from the store.

func (*Store) List

func (s *Store) List(ctx context.Context, request *jobqueue.ListRequest) (*jobqueue.ListResponse, error)

List returns a list of all jobs stored in the data store.

func (*Store) Lookup

func (s *Store) Lookup(ctx context.Context, id string) (*jobqueue.Job, error)

Lookup retrieves a single job in the store by its identifier.

func (*Store) LookupByCorrelationID

func (s *Store) LookupByCorrelationID(ctx context.Context, correlationID string) ([]*jobqueue.Job, error)

LookupByCorrelationID returns the details of jobs by their correlation identifier. If no such job could be found, an empty array is returned.

func (*Store) Next

func (s *Store) Next() (*jobqueue.Job, error)

Next picks the next job to execute, or nil if no executable job is available.

func (*Store) Start

func (s *Store) Start(b jobqueue.StartupBehaviour) error

Start is called when the manager starts up. We ensure that stale jobs are marked as failed so that we have place for new jobs.

func (*Store) Stats

func (s *Store) Stats(ctx context.Context, req *jobqueue.StatsRequest) (*jobqueue.Stats, error)

Stats returns statistics about the jobs in the store.

func (*Store) Update

func (s *Store) Update(ctx context.Context, job *jobqueue.Job) error

Update updates the job in the store.

type StoreOption

type StoreOption func(*Store)

StoreOption is an options provider for Store.

func SetDebug

func SetDebug(enabled bool) StoreOption

SetDebug indicates whether to enable or disable debugging (which will output SQL to the console).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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