diff options
author | Valery Piashchynski <[email protected]> | 2021-07-06 17:30:31 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-06 17:30:31 +0300 |
commit | 2c78e93222cc9d3b88456175348e42f7f40c449b (patch) | |
tree | be4fc671db33ceb8700019a5ede900c8d900d7c0 /common/jobs | |
parent | 207739f7346c98e16087547bc510e1f909671260 (diff) |
Rework ephemeral and binary heaps
Implemented a sync.Cond for binary heap algo to save processor from
spinning in the for loop and receiving nil Items until the Queue will be
filled.
Add num_pollers option to the configuration to specify number of
pollers from the queue.
Add Resume, ResumeAll, Stop, StopAll, PushBatch methods to the ephemeral.
Remove map and use sync.Map in the ephemeral broker.
Add protobuf schema.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'common/jobs')
-rw-r--r-- | common/jobs/interface.go | 26 |
1 files changed, 26 insertions, 0 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) +} |