1 | <?php |
||
10 | class Connection extends ClientConnection |
||
11 | { |
||
12 | /** |
||
13 | * Generic error while executing the query. |
||
14 | */ |
||
15 | const REPL_ERR = 0x00; |
||
16 | /** |
||
17 | * Specified key was not found. |
||
18 | */ |
||
19 | const REPL_ERR_NOT_FOUND = 0x01; |
||
20 | /** |
||
21 | * Expected a number ( TTL or TIME ) but the specified value was invalid. |
||
22 | */ |
||
23 | const REPL_ERR_NAN = 0x02; |
||
24 | /** |
||
25 | * The server reached configuration memory limit and will not accept any new value until its freeing routine will be executed. |
||
|
|||
26 | */ |
||
27 | const REPL_ERR_MEM = 0x03; |
||
28 | /** |
||
29 | * The specificed key was locked by a OP_LOCK or a OP_MLOCK query. |
||
30 | */ |
||
31 | const REPL_ERR_LOCKED = 0x04; |
||
32 | /** |
||
33 | * Query succesfully executed, no data follows. |
||
34 | */ |
||
35 | const REPL_OK = 0x05; |
||
36 | /** |
||
37 | * Query succesfully executed, value data follows. |
||
38 | */ |
||
39 | const REPL_VAL = 0x06; |
||
40 | /** |
||
41 | * Query succesfully executed, multiple key => value data follows. |
||
42 | */ |
||
43 | const REPL_KVAL = 0x07; |
||
44 | const STATE_PACKET_HDR = 0x01; |
||
45 | const STATE_PACKET_DATA = 0x02; |
||
46 | /** |
||
47 | * Raw string data follows. |
||
48 | */ |
||
49 | const GB_ENC_PLAIN = 0x00; |
||
50 | /** |
||
51 | * Compressed data, this is a reserved value not used for replies. |
||
52 | */ |
||
53 | const GB_ENC_LZF = 0x01; |
||
54 | /** |
||
55 | * Packed long number follows, four bytes for 32bit architectures, eight bytes for 64bit. |
||
56 | */ |
||
57 | const GB_ENC_NUMBER = 0x02; |
||
58 | /** |
||
59 | * @var string error message |
||
60 | */ |
||
61 | public $error; |
||
62 | public $responseCode; |
||
63 | public $encoding; |
||
64 | public $responseLength; |
||
65 | public $result; |
||
66 | public $isFinal = false; |
||
67 | public $totalNum; |
||
68 | public $readedNum; |
||
69 | /** |
||
70 | * @var integer Default low mark. Minimum number of bytes in buffer |
||
71 | */ |
||
72 | protected $lowMark = 2; |
||
73 | protected $maxQueue = 10; |
||
74 | |||
75 | /** |
||
76 | * Called when the connection is handshaked (at low-level), and peer is ready to recv. data |
||
77 | * @return void |
||
78 | */ |
||
79 | public function onReady() |
||
84 | |||
85 | /** |
||
86 | * @TODO isFinal |
||
87 | * @return boolean |
||
88 | */ |
||
89 | public function isFinal() |
||
93 | |||
94 | /** |
||
95 | * @TODO getTotalNum |
||
96 | * @return integer |
||
97 | */ |
||
98 | public function getTotalNum() |
||
102 | |||
103 | /** |
||
104 | * @TODO getReadedNum |
||
105 | * @return integer |
||
106 | */ |
||
107 | public function getReadedNum() |
||
111 | |||
112 | /** |
||
113 | * @TODO getResponseCode |
||
114 | * @return integer |
||
115 | */ |
||
116 | public function getResponseCode() |
||
120 | |||
121 | /** |
||
122 | * onRead |
||
123 | * @return void |
||
124 | */ |
||
125 | protected function onRead() |
||
272 | |||
273 | /** |
||
274 | * @TODO executeCb |
||
275 | * @return void |
||
276 | */ |
||
277 | protected function executeCb() |
||
289 | } |
||
290 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.