Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Queue\Adapter; |
15 | |
16 | use Pop\Queue\Process\AbstractJob; |
17 | use Pop\Queue\Process\Task; |
18 | |
19 | /** |
20 | * Adapter interface |
21 | * |
22 | * @category Pop |
23 | * @package Pop\Queue |
24 | * @author Nick Sagona, III <dev@nolainteractive.com> |
25 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
26 | * @license http://www.popphp.org/license New BSD License |
27 | * @version 2.0.0 |
28 | */ |
29 | interface AdapterInterface |
30 | { |
31 | |
32 | /** |
33 | * Set queue priority |
34 | * |
35 | * @param string $priority |
36 | * @return AdapterInterface |
37 | */ |
38 | public function setPriority(string $priority = 'FIFO'): AdapterInterface; |
39 | |
40 | /** |
41 | * Get queue priority |
42 | * |
43 | * @return string |
44 | */ |
45 | public function getPriority(): string; |
46 | |
47 | /** |
48 | * Is FIFO |
49 | * |
50 | * @return bool |
51 | */ |
52 | public function isFifo(): bool; |
53 | |
54 | /** |
55 | * Is FILO |
56 | * |
57 | * @return bool |
58 | */ |
59 | public function isFilo(): bool; |
60 | |
61 | /** |
62 | * Is LILO (alias to FIFO) |
63 | * |
64 | * @return bool |
65 | */ |
66 | public function isLilo(): bool; |
67 | |
68 | /** |
69 | * Is LIFO (alias to FILO) |
70 | * |
71 | * @return bool |
72 | */ |
73 | public function isLifo(): bool; |
74 | |
75 | /** |
76 | * Get queue start index |
77 | * |
78 | * @return int |
79 | */ |
80 | public function getStart(): int; |
81 | |
82 | /** |
83 | * Get queue end index |
84 | * |
85 | * @return int |
86 | */ |
87 | public function getEnd(): int; |
88 | |
89 | /** |
90 | * Get queue job status |
91 | * |
92 | * @param int $index |
93 | * @return int |
94 | */ |
95 | public function getStatus(int $index): int; |
96 | |
97 | /** |
98 | * Push job on to queue |
99 | * |
100 | * @param AbstractJob $job |
101 | * @return AdapterInterface |
102 | */ |
103 | public function push(AbstractJob $job): AdapterInterface; |
104 | |
105 | /** |
106 | * Pop job off of queue |
107 | * |
108 | * @return ?AbstractJob |
109 | */ |
110 | public function pop(): ?AbstractJob; |
111 | |
112 | /** |
113 | * Check if adapter has jobs |
114 | * |
115 | * @return bool |
116 | */ |
117 | public function hasJobs(): bool; |
118 | |
119 | /** |
120 | * Check if adapter has failed job |
121 | * |
122 | * @param int $index |
123 | * @return bool |
124 | */ |
125 | public function hasFailedJob(int $index): bool; |
126 | |
127 | /** |
128 | * Get failed job |
129 | * |
130 | * @param int $index |
131 | * @param bool $unserialize |
132 | * @return mixed |
133 | */ |
134 | public function getFailedJob(int $index, bool $unserialize = true): mixed; |
135 | |
136 | /** |
137 | * Check if adapter has failed jobs |
138 | * |
139 | * @return bool |
140 | */ |
141 | public function hasFailedJobs(): bool; |
142 | |
143 | /** |
144 | * Get adapter failed jobs |
145 | * |
146 | * @param bool $unserialize |
147 | * @return array |
148 | */ |
149 | public function getFailedJobs(bool $unserialize = true): array; |
150 | |
151 | /** |
152 | * Clear failed jobs out of the queue |
153 | * |
154 | * @return AdapterInterface |
155 | */ |
156 | public function clearFailed(): AdapterInterface; |
157 | |
158 | /** |
159 | * Clear jobs out of queue |
160 | * |
161 | * @return AdapterInterface |
162 | */ |
163 | public function clear(): AdapterInterface; |
164 | |
165 | } |