1 | <?php |
||
9 | abstract class PriorityJobManager extends RetryableJobManager |
||
10 | { |
||
11 | const PRIORITY_ASC = 'asc'; |
||
12 | const PRIORITY_DESC = 'desc'; |
||
13 | |||
14 | protected $maxPriority; |
||
15 | protected $priorityDirection = self::PRIORITY_DESC; |
||
16 | |||
17 | /** |
||
18 | * @return mixed |
||
19 | */ |
||
20 | public function getMaxPriority() |
||
24 | |||
25 | /** |
||
26 | * @param mixed $maxPriority |
||
27 | */ |
||
28 | public function setMaxPriority($maxPriority) |
||
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | */ |
||
36 | public function getPriorityDirection() |
||
40 | |||
41 | /** |
||
42 | * @param mixed $priorityDirection |
||
43 | */ |
||
44 | public function setPriorityDirection($priorityDirection) |
||
48 | |||
49 | protected function validatePriority($priority) |
||
66 | |||
67 | /** |
||
68 | * Returns the prioirty in ASCENDING order regardless of the User's choice of direction |
||
69 | * (for storing RabbitMQ, Mysql, others). |
||
70 | * |
||
71 | * @param $priority |
||
72 | * |
||
73 | * @return mixed |
||
74 | */ |
||
75 | protected function calculatePriority($priority) |
||
86 | |||
87 | protected function findHigherPriority($priority1, $priority2) |
||
102 | |||
103 | abstract protected function prioritySave(Job $job); |
||
104 | |||
105 | /** |
||
106 | * @param Job $job |
||
107 | * |
||
108 | * @throws PriorityException |
||
109 | */ |
||
110 | protected function retryableSave(RetryableJob $job) |
||
121 | } |
||
122 |