queue.go 481 B

123456789101112131415161718
  1. package worker
  2. import "context"
  3. //go:generate moq -pkg mock -out mock/queue.go . Queue
  4. type QorJobDefinition struct {
  5. Name string
  6. Handler JobHandler
  7. }
  8. type Queue interface {
  9. Add(ctx context.Context, job QueJobInterface) error
  10. Kill(ctx context.Context, job QueJobInterface) error
  11. Remove(ctx context.Context, job QueJobInterface) error
  12. Listen(jobDefs []*QorJobDefinition, getJob func(qorJobID uint) (QueJobInterface, error)) error
  13. Shutdown(ctx context.Context) error
  14. }