Beanstalk.php
1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php 
namespace Phalcon\Queue {
	/**
	 * Phalcon\Queue\Beanstalk
	 *
	 * Class to access the beanstalk queue service.
	 * Partially implements the protocol version 1.2
	 *
	 * @see http://www.igvita.com/2010/05/20/scalable-work-queues-with-beanstalk/
	 */
	
	class Beanstalk {
		protected $_connection;
		protected $_parameters;
		/**
		 * \Phalcon\Queue\Beanstalk
		 *
		 * @param array $options
		 */
		public function __construct($options=null){ }
		public function connect(){ }
		/**
		 * Inserts jobs into the queue
		 *
		 * @param string $data
		 * @param array $options
		 */
		public function put($data, $options=null){ }
		/**
		 * Reserves a job in the queue
		 *
		 * @return boolean|Phalcon\Queue\Beanstalk\Job
		 */
		public function reserve($timeout=null){ }
		/**
		 * Change the active tube. By default the tube is 'default'
		 *
		 * @param string $tube
		 * @return string|boolean
		 */
		public function choose($tube){ }
		/**
		 * Change the active tube. By default the tube is 'default'
		 *
		 * @param string $tube
		 * @return string|boolean
		 */
		public function watch($tube){ }
		/**
		 * Inspect the next ready job.
		 *
		 * @return boolean|Phalcon\Queue\Beanstalk\Job
		 */
		public function peekReady(){ }
		/**
		 * Reads the latest status from the Beanstalkd server
		 *
		 * @return array
		 */
		protected function readStatus(){ }
		/**
		 * Reads a packet from the socket. Prior to reading from the socket will
		 * check for availability of the connection.
		 *
		 * @param int $length Number of bytes to read.
		 * @return string|boolean Data or `false` on error.
		 */
		public function read($length=null){ }
		/**
		 * Writes data to the socket. Performs a connection if none is available
		 *
		 * @param string $data
		 * @return integer|boolean
		 */
		protected function write(){ }
		/**
		 * Closes the connection to the beanstalk server.
		 *
		 * @return boolean
		 */
		public function disconnect(){ }
	}
}