Last active
March 30, 2021 11:51
-
-
Save rishabh-gupta2/75d52e69bd9423f00942e973fbd0898f to your computer and use it in GitHub Desktop.
Store interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Store provides an interface for persisting and reading jobs. | |
type Store interface { | |
// FindPendingJobsToProcess reads new jobs to be processed, | |
// and marks them as processing atomically. | |
FindPendingJobsToProcess(ctx context.Context, jobBatchSize int32, jobProcessingTimeout time.Duration) ([]*Job, error) | |
// FindFailedJobsToProcess reads failed jobs to be processed again, | |
// and marks them as processing atomically. | |
FindFailedJobsToProcess(ctx context.Context, jobBatchSize int32) ([]*Job, error) | |
// CreateJob persists a new job. | |
CreateJob(context.Context, *gorm.DB, *Job) error | |
// Delete deletes a processed job. | |
DeleteJob(ctx context.Context, jobID string) error | |
// Update updates a failed job, setting status and attempts info. | |
// Marks job as either JobStatusFailed or JobStatusRetryExhausted. | |
UpdateJob(context.Context, *Job) error | |
// RegisterMetrics registers prometheus metrics for Store interface. | |
RegisterMetrics(registerer prometheus.Registerer) error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment