summaryrefslogtreecommitdiff
path: root/plugins/jobs/pq_plugin/plugin.go
blob: 7df846ac6d4d91d16eeb11ae5200d3236c24aeb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package pq_plugin //nolint:stylecheck

import (
	priorityqueue "github.com/spiral/roadrunner/v2/pkg/priority_queue"
	"github.com/spiral/roadrunner/v2/plugins/logger"
)

const (
	PluginName string = "internal_pq"
)

type Plugin struct {
	log logger.Logger
	pq  priorityqueue.Queue
}

func (p *Plugin) Init(log logger.Logger) error {
	p.log = log
	p.pq = priorityqueue.NewPriorityQueue()
	return nil
}

func (p *Plugin) Push(item interface{}) {
	p.pq.Push(item)
	// no-op
}

func (p *Plugin) Pop() interface{} {
	return p.pq.Pop()
}

func (p *Plugin) Name() string {
	return PluginName
}