1: <?php
2:
3: namespace Charcoal\Queue;
4:
5: /**
6: * The queue manager is used to load queued items and batch-process them.
7: */
8: interface QueueManagerInterface
9: {
10: /**
11: * Set the queue's ID.
12: *
13: * @param mixed $id The unique queue identifier.
14: * @return QueueManagerInterface Chainable
15: */
16: public function setQueueId($id);
17:
18: /**
19: * Get the queue's ID.
20: *
21: * @return mixed
22: */
23: public function queueId();
24:
25: /**
26: * Set the callback routine when the item is resolved.
27: *
28: * @param callable $callback A item callback routine.
29: * @return QueueManagerInterface Chainable
30: */
31: public function setItemSuccessCallback(callable $callback);
32:
33: /**
34: * Set the callback routine when the item is rejected.
35: *
36: * @param callable $callback A item callback routine.
37: * @return QueueManagerInterface Chainable
38: */
39: public function setItemFailureCallback(callable $callback);
40:
41: /**
42: * Set the callback routine when the queue is processed.
43: *
44: * @param callable $callback A queue callback routine.
45: * @return QueueManagerInterface Chainable
46: */
47: public function setProcessedCallback(callable $callback);
48:
49: /**
50: * Process the items of the queue.
51: *
52: * @return boolean Success / Failure
53: */
54: public function processQueue();
55:
56: /**
57: * Retrieve the items of the current queue.
58: *
59: * @return Collection
60: */
61: public function loadQueueItems();
62:
63: /**
64: * Retrieve the queue item's model.
65: *
66: * @return QueueItemInterface
67: */
68: public function queueItemProto();
69: }
70: