Storage
2 years ago
FileSeekableQueue.php
1 year ago
FinishedQueueException.php
5 years ago
Queue.php
1 year ago
QueueInterface.php
4 years ago
SeekableQueueInterface.php
4 years ago
SeekableQueueInterface.php
70 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Framework\Queue; |
| 4 | |
| 5 | interface SeekableQueueInterface |
| 6 | { |
| 7 | /** @var string Write-only queue. Optimized for writing. */ |
| 8 | const MODE_WRITE = 'ab'; |
| 9 | |
| 10 | /** @var string Read/write queue. Versatile, but a little bit slower. */ |
| 11 | const MODE_READ_WRITE = 'rb+'; |
| 12 | |
| 13 | public function setup($queueName, $queueMode = SeekableQueueInterface::MODE_READ_WRITE); |
| 14 | |
| 15 | /** |
| 16 | * Whether the Queue has more items. |
| 17 | * |
| 18 | * @return bool |
| 19 | */ |
| 20 | public function isFinished(); |
| 21 | |
| 22 | /** |
| 23 | * Returns the current element in the Queue and move the pointer to the next. |
| 24 | * |
| 25 | * @return mixed |
| 26 | */ |
| 27 | public function dequeue(); |
| 28 | |
| 29 | /** |
| 30 | * Append item to the end of the queue |
| 31 | * |
| 32 | * @param mixed $data |
| 33 | */ |
| 34 | public function enqueue($data); |
| 35 | |
| 36 | /** |
| 37 | * Push array of items to the end of the queue |
| 38 | * |
| 39 | * @param array $data |
| 40 | */ |
| 41 | public function enqueueMany(array $data = []); |
| 42 | |
| 43 | /** |
| 44 | * Rollback the pointer to repeat the item that was just returned. |
| 45 | * |
| 46 | * @return mixed |
| 47 | */ |
| 48 | public function retry($dequeue = true); |
| 49 | |
| 50 | /** |
| 51 | * Removes all the items from the queue |
| 52 | */ |
| 53 | public function reset(); |
| 54 | |
| 55 | /** |
| 56 | * Seek the Queue to given offset |
| 57 | */ |
| 58 | public function seek($offset); |
| 59 | |
| 60 | /** |
| 61 | * Returns the Queue offset |
| 62 | */ |
| 63 | public function getOffset(); |
| 64 | |
| 65 | /** |
| 66 | * Close all connection to the queue |
| 67 | */ |
| 68 | public function shutdown(); |
| 69 | } |
| 70 |