summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-23 17:41:51 +0300
committerValery Piashchynski <[email protected]>2021-06-23 17:41:51 +0300
commit521aeb823bc8fa1f0a91b540cbbac96328185f51 (patch)
tree9ec5f3fba0a4aa0469dd106040142c5e6b8cf144 /pkg
parent7fc09959619e9e400ecafcffcd63e38812f397a6 (diff)
- Add PQ (priority_queue) mock
- Add binary heap mock - Connect first sub-plugin (ephemeral) with root jobs plugin Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/priority_queue/binary_heap.go12
-rw-r--r--pkg/priority_queue/interface.go7
-rw-r--r--pkg/priority_queue/queue.go20
3 files changed, 39 insertions, 0 deletions
diff --git a/pkg/priority_queue/binary_heap.go b/pkg/priority_queue/binary_heap.go
new file mode 100644
index 00000000..c660ddb6
--- /dev/null
+++ b/pkg/priority_queue/binary_heap.go
@@ -0,0 +1,12 @@
+/*
+binary heap (min-heap) algorithm used as a core for the priority queue
+*/
+
+package priorityqueue
+
+type BinHeap struct {
+}
+
+func NewBinHeap() *BinHeap {
+ return &BinHeap{}
+}
diff --git a/pkg/priority_queue/interface.go b/pkg/priority_queue/interface.go
new file mode 100644
index 00000000..d1c3229f
--- /dev/null
+++ b/pkg/priority_queue/interface.go
@@ -0,0 +1,7 @@
+package priorityqueue
+
+type Queue interface {
+ Push()
+ Pop()
+ BLPop()
+}
diff --git a/pkg/priority_queue/queue.go b/pkg/priority_queue/queue.go
index f09b99ff..88d18acb 100644
--- a/pkg/priority_queue/queue.go
+++ b/pkg/priority_queue/queue.go
@@ -1 +1,21 @@
package priorityqueue
+
+type QueueImpl struct {
+}
+
+func NewPriorityQueue() *QueueImpl {
+ return nil
+}
+
+// Push the task
+func (q *QueueImpl) Push() {
+
+}
+
+func (q *QueueImpl) Pop() {
+
+}
+
+func (q *QueueImpl) BLPop() {
+
+}