Documentation ¶
Index ¶
- Constants
- func AddSimple(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string) error
- func AddWithData(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error
- func AddWithDataAndDelay(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error
- func AddWithDelay(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error
- type Config
- type Handler
- type HandlerMap
- type Queue
- type QueueMock
- type SubFunc
- type TypeConfig
Constants ¶
View Source
const ( // CRC16("github.com/privatix/dappctrl/job") = 0x765D ErrAlreadyProcessing errors.Error = 0x765D<<8 + iota ErrDuplicatedJob ErrHandlerNotFound ErrQueueClosed ErrSubscriptionExists ErrSubscriptionNotFound ErrInternal )
Errors.
View Source
const ( MockAdd = iota MockProcess MockClose MockSubscribe MockUnsubscribe )
Mock methods.
Variables ¶
This section is empty.
Functions ¶
func AddWithData ¶
func AddWithData(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, jobData interface{}) error
AddWithData is convenience method to add a job with given data.
Types ¶
type Config ¶
type Config struct { CollectJobs uint // Number of jobs to process for collect-iteration. CollectPeriod uint // Collect-iteration period, in milliseconds. WorkerBufLen uint // Worker buffer length. Workers uint // Number of workers, 0 means number of CPUs. TypeConfig // Default type configuration. Types map[string]TypeConfig // Type-specific overrides. }
Config is a job queue configuration.
type Queue ¶
type Queue interface { Add(tx *reform.TX, j *data.Job) error Process() error Close() Subscribe(subKeys []string, subID string, subFunc SubFunc) error Unsubscribe(subKeys []string, subID string) error }
Queue is a job processing queue.
type QueueMock ¶
type QueueMock func(method int, tx *reform.TX, job *data.Job, relatedIDs []string, subID string, subFunc SubFunc) error
QueueMock is a queue method handler.
func NewDummyQueueMock ¶
func NewDummyQueueMock() QueueMock
NewDummyQueueMock returns a queue mock which does nothing.
func (QueueMock) Close ¶
func (q QueueMock) Close()
Close is a mock implementation for the Close queue method.
type TypeConfig ¶
type TypeConfig struct { TryLimit uint8 // Default number of tries to complete job. TryPeriod uint // Default retry period, in milliseconds. Duplicated bool // Whether do or do not check for duplicates. FirstStartDelay uint // Default first run delay after job added, in milliseconds. }
TypeConfig is a configuration for specific job type.
Click to show internal directories.
Click to hide internal directories.