diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/jobs/interface.go | 26 | ||||
-rw-r--r-- | common/priority_queue/interface.go | 15 |
2 files changed, 26 insertions, 15 deletions
diff --git a/common/jobs/interface.go b/common/jobs/interface.go new file mode 100644 index 00000000..6738ed46 --- /dev/null +++ b/common/jobs/interface.go @@ -0,0 +1,26 @@ +package jobs + +import ( + "github.com/spiral/roadrunner/v2/pkg/priorityqueue" + "github.com/spiral/roadrunner/v2/plugins/jobs/pipeline" + "github.com/spiral/roadrunner/v2/plugins/jobs/structs" +) + +// Consumer todo naming +type Consumer interface { + Push(job *structs.Job) (*string, error) + PushBatch(job *[]structs.Job) (*string, error) + Consume(job *pipeline.Pipeline) + + Stop(pipeline string) + StopAll() + Resume(pipeline string) + ResumeAll() + + Register(pipe string) error + Stat() +} + +type Constructor interface { + JobsConstruct(configKey string, queue priorityqueue.Queue) (Consumer, error) +} diff --git a/common/priority_queue/interface.go b/common/priority_queue/interface.go deleted file mode 100644 index c1774223..00000000 --- a/common/priority_queue/interface.go +++ /dev/null @@ -1,15 +0,0 @@ -package priorityqueue - -type Queue interface { - Insert(item Item) - GetMax() Item -} - -type Item interface { - ID() string - Priority() uint64 - Ack() - Nack() - Body() []byte - Context() []byte -} |