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 | 38 | public function getMaxPriority() |
|
24 | |||
25 | /** |
||
26 | * @param mixed $maxPriority |
||
27 | */ |
||
28 | 20 | public function setMaxPriority($maxPriority) |
|
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | */ |
||
36 | 19 | public function getPriorityDirection() |
|
40 | |||
41 | /** |
||
42 | * @param mixed $priorityDirection |
||
43 | */ |
||
44 | 24 | public function setPriorityDirection($priorityDirection) |
|
48 | |||
49 | 69 | 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 | 69 | protected function calculatePriority($priority) |
|
86 | |||
87 | abstract protected function prioritySave(Job $job); |
||
88 | |||
89 | /** |
||
90 | * @param Job $job |
||
91 | * |
||
92 | * @throws PriorityException |
||
93 | */ |
||
94 | 69 | protected function retryableSave(RetryableJob $job) |
|
105 | } |
||
106 |