summaryrefslogtreecommitdiff
path: root/pkg/priority_queue/binary_heap.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-05 18:44:29 +0300
committerValery Piashchynski <[email protected]>2021-07-05 18:44:29 +0300
commit207739f7346c98e16087547bc510e1f909671260 (patch)
tree5c6eac27beb4eb5e127c7d8dae3464edb3359be9 /pkg/priority_queue/binary_heap.go
parent300166eda7b138847008a7653f90753bd8397b9e (diff)
- Update PQ
- Update ephemeral plugin, complete Push - Add Jobs full configuration Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/priority_queue/binary_heap.go')
-rw-r--r--pkg/priority_queue/binary_heap.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/priority_queue/binary_heap.go b/pkg/priority_queue/binary_heap.go
index 02d413aa..c7c148da 100644
--- a/pkg/priority_queue/binary_heap.go
+++ b/pkg/priority_queue/binary_heap.go
@@ -4,7 +4,9 @@ binary heap (min-heap) algorithm used as a core for the priority queue
package priorityqueue
-type BinHeap []PQItem
+import priorityqueue "github.com/spiral/roadrunner/v2/common/priority_queue"
+
+type BinHeap []priorityqueue.Item
func NewBinHeap() *BinHeap {
return &BinHeap{}
@@ -53,12 +55,12 @@ func (bh *BinHeap) fixDown(curr, end int) {
}
}
-func (bh *BinHeap) Insert(item PQItem) {
+func (bh *BinHeap) Insert(item priorityqueue.Item) {
*bh = append(*bh, item)
bh.fixUp()
}
-func (bh *BinHeap) GetMax() PQItem {
+func (bh *BinHeap) GetMax() priorityqueue.Item {
l := len(*bh)
if l == 0 {
return nil