Documentation ¶
Index ¶
Constants ¶
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` ScheduledFor time.Time `db:"scheduled_for" json:"scheduled_for"` FailedAttempts int64 `db:"failed_attempts" json:"failed_attempts"` // priority: i64, Status JobStatus `db:"status" json:"status"` Type string `db:"type" json:"type"` RawData json.RawMessage `db:"data" json:"data"` RetryMax int64 `db:"retry_max" json:"retry_max"` RetryDelay int64 `db:"retry_delay" json:"retry_delay"` RetryStrategy RetryStrategy `db:"retry_strategy" json:"retry_strategy"` Timeout int64 `db:"timeout" json:"timeout"` }
type JobStatus ¶
type JobStatus int32
func (JobStatus) MarshalText ¶
func (*JobStatus) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type NewJobInput ¶
type NewJobInput struct { Data JobData // ScheduledFor is the date when the job should be scheduled for // default: time.Now() ScheduledFor *time.Time // RetryMax is the max number of times a job should be retried // 0-100 // default: 5 RetryMax *int64 // RetryDelay is the number of seconds between 2 retry attempts. Allowed range: 1-86400 // default: 5 RetryDelay *int64 // constant, exponential // default: Constant RetryStrategy RetryStrategy // Timeout in seconds. Allows range: 1-7200 // default: 60 Timeout *int64 }
type Queue ¶
type Queue interface { Push(ctx context.Context, tx db.Queryer, newJob NewJobInput) error PushMany(ctx context.Context, t db.Tx, newJobs []NewJobInput) error // pull fetches at most `number_of_jobs` from the queue. Pull(ctx context.Context, numberOfJobs uint64) ([]Job, error) DeleteJob(ctx context.Context, jobID uuid.UUID) error FailJob(ctx context.Context, job Job) error Clear(ctx context.Context) error GetJob(ctx context.Context, jobID uuid.UUID) (job Job, err error) GetFailedJobs(ctx context.Context) (jobs []Job, err error) }
type RetryStrategy ¶
type RetryStrategy int32
const ( RetryStrategyConstant RetryStrategy = iota RetryStrategyExponential )
func (RetryStrategy) MarshalText ¶
func (strategy RetryStrategy) MarshalText() (ret []byte, err error)
func (RetryStrategy) String ¶
func (strategy RetryStrategy) String() string
func (*RetryStrategy) UnmarshalText ¶
func (strategy *RetryStrategy) UnmarshalText(data []byte) (err error)
UnmarshalText implements encoding.TextUnmarshaler.
Click to show internal directories.
Click to hide internal directories.