Skip to content

Commit c961851

Browse files
authored
Merge pull request andreiz#36 from dtakken/update-api-stubs
Some updates to the PHP API stubs
2 parents 32ee5a8 + 64dd13f commit c961851

File tree

1 file changed

+74
-5
lines changed

1 file changed

+74
-5
lines changed

zookeeper-api.php

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
/**
44
* Zookeeper class.
5+
* @link https://www.php.net/manual/en/class.zookeeper.php
56
*/
67
class Zookeeper
78
{
@@ -64,13 +65,16 @@ class Zookeeper
6465

6566

6667
/**
67-
* Create a handle to used communicate with zookeeper. * if the host is provided, attempt to connect.
68+
* Create a handle to used communicate with zookeeper.
69+
* If the host is provided, attempt to connect.
6870
*
6971
* @param string $host
7072
* @param callable $watcher_cb
7173
* @param int $recv_timeout
7274
*
73-
* @throws ZookeeperConnectionException when host is provided and when failed to connect to the host.
75+
* @link https://www.php.net/manual/en/zookeeper.construct.php
76+
*
77+
* @throws ZookeeperConnectionException when host is provided and when failed to connect to the host
7478
*/
7579
public function __construct($host = '', $watcher_cb = null, $recv_timeout = 10000)
7680
{
@@ -83,12 +87,25 @@ public function __construct($host = '', $watcher_cb = null, $recv_timeout = 1000
8387
* @param callable $watcher_cb
8488
* @param int $recv_timeout
8589
*
90+
* @link https://www.php.net/manual/en/zookeeper.connect.php
91+
*
8692
* @throws ZookeeperConnectionException when failed to connect to Zookeeper
8793
*/
8894
public function connect($host, $watcher_cb = null, $recv_timeout = 10000)
8995
{
9096
}
9197

98+
/**
99+
* Close the zookeeper handle and free up any resources.
100+
*
101+
* @link https://www.php.net/manual/en/zookeeper.close.php
102+
*
103+
* @throws ZookeeperConnectionException when closing an uninitialized instance
104+
*/
105+
public function close()
106+
{
107+
}
108+
92109
/**
93110
* Create a node synchronously.
94111
*
@@ -98,7 +115,11 @@ public function connect($host, $watcher_cb = null, $recv_timeout = 10000)
98115
* @param int $flags
99116
*
100117
* @return string
118+
*
119+
* @link https://www.php.net/manual/en/zookeeper.create.php
120+
*
101121
* @throws ZookeeperException
122+
* @throws ZookeeperNoNodeException when parent path does not exist
102123
*/
103124
public function create($path, $value, $acl, $flags = null)
104125
{
@@ -111,7 +132,11 @@ public function create($path, $value, $acl, $flags = null)
111132
* @param int $version
112133
*
113134
* @return bool
135+
*
136+
* @link https://www.php.net/manual/en/zookeeper.delete.php
137+
*
114138
* @throws ZookeeperException
139+
* @throws ZookeeperNoNodeException when path does not exist
115140
*/
116141
public function delete($path, $version = -1)
117142
{
@@ -126,7 +151,11 @@ public function delete($path, $version = -1)
126151
* @param array $stat
127152
*
128153
* @return bool
129-
* @throws ZookeeperException
154+
*
155+
* @link https://www.php.net/manual/en/zookeeper.set.php
156+
*
157+
* @throws ZookeeperException when the version check fails
158+
* @throws ZookeeperNoNodeException when path does not exist
130159
*/
131160
public function set($path, $data, $version = -1, &$stat = null)
132161
{
@@ -141,7 +170,11 @@ public function set($path, $data, $version = -1, &$stat = null)
141170
* @param int $max_size
142171
*
143172
* @return string
173+
*
174+
* @link https://www.php.net/manual/en/zookeeper.get.php
175+
*
144176
* @throws ZookeeperException
177+
* @throws ZookeeperNoNodeException when path does not exist
145178
*/
146179
public function get($path, $watcher_cb = null, &$stat = null, $max_size = 0)
147180
{
@@ -154,7 +187,11 @@ public function get($path, $watcher_cb = null, &$stat = null, $max_size = 0)
154187
* @param callable $watcher_cb
155188
*
156189
* @return array
157-
* @throws ZookeeperException when connection not in connected status
190+
*
191+
* @link https://www.php.net/manual/en/zookeeper.getchildren.php
192+
*
193+
* @throws ZookeeperException when connection not in connected status
194+
* @throws ZookeeperNoNodeException when path does not exist
158195
*/
159196
public function getChildren($path, $watcher_cb = null)
160197
{
@@ -167,6 +204,9 @@ public function getChildren($path, $watcher_cb = null)
167204
* @param callable $watcher_cb
168205
*
169206
* @return bool
207+
*
208+
* @link https://www.php.net/manual/en/zookeeper.exists.php
209+
*
170210
* @throws ZookeeperException
171211
*/
172212
public function exists($path, $watcher_cb = null)
@@ -179,6 +219,9 @@ public function exists($path, $watcher_cb = null)
179219
* @param string $path
180220
*
181221
* @return array
222+
*
223+
* @link https://www.php.net/manual/en/zookeeper.getacl.php
224+
*
182225
* @throws ZookeeperException when connection not in connected status
183226
*/
184227
public function getAcl($path)
@@ -192,7 +235,10 @@ public function getAcl($path)
192235
* @param int $version
193236
* @param array $acls
194237
*
238+
* @link https://www.php.net/manual/en/zookeeper.setacl.php
239+
*
195240
* @return bool
241+
*
196242
* @throws ZookeeperException when connection not in connected status
197243
*/
198244
public function setAcl($path, $version, $acls)
@@ -201,9 +247,12 @@ public function setAcl($path, $version, $acls)
201247

202248
/**
203249
* return the client session id, only valid if the connections is currently connected
204-
* (ie. last watcher state is ZOO_CONNECTED_STATE)
250+
* (ie. last watcher state is ZOO_CONNECTED_STATE).
205251
*
206252
* @return int
253+
*
254+
* @link https://www.php.net/manual/en/zookeeper.getclientid.php
255+
*
207256
* @throws ZookeeperConnectionException when connection not in connected status
208257
*/
209258
public function getClientId()
@@ -216,6 +265,9 @@ public function getClientId()
216265
* @param callable $watcher_cb
217266
*
218267
* @return bool
268+
*
269+
* @link https://www.php.net/manual/en/zookeeper.setwatcher.php
270+
*
219271
* @throws ZookeeperConnectionException when connection not in connected status
220272
*/
221273
public function setWatcher($watcher_cb)
@@ -226,6 +278,9 @@ public function setWatcher($watcher_cb)
226278
* Get the state of the zookeeper connection.
227279
*
228280
* @return int
281+
*
282+
* @link https://www.php.net/manual/en/zookeeper.getstate.php
283+
*
229284
* @throws ZookeeperConnectionException when connection not in connected status
230285
*/
231286
public function getState()
@@ -237,6 +292,9 @@ public function getState()
237292
* (ie. last watcher state is ZOO_CONNECTED_STATE). This value may change after a server reconnect.
238293
*
239294
* @return int
295+
*
296+
* @link https://www.php.net/manual/en/zookeeper.getrecvtimeout.php
297+
*
240298
* @throws ZookeeperConnectionException when connection not in connected status
241299
*/
242300
public function getRecvTimeout()
@@ -250,6 +308,8 @@ public function getRecvTimeout()
250308
* @param string $cert
251309
* @param callable $completion_cb
252310
*
311+
* @link https://www.php.net/manual/en/zookeeper.addauth.php
312+
*
253313
* @return bool
254314
*/
255315
public function addAuth($scheme, $cert, $completion_cb = null)
@@ -260,6 +320,9 @@ public function addAuth($scheme, $cert, $completion_cb = null)
260320
* Checks if the current zookeeper connection state can be recovered.
261321
*
262322
* @return bool
323+
*
324+
* @link https://www.php.net/manual/en/zookeeper.isrecoverable.php
325+
*
263326
* @throws ZookeeperConnectionException when connection not in connected status
264327
*/
265328
public function isRecoverable()
@@ -273,6 +336,8 @@ public function isRecoverable()
273336
*
274337
* @param resource $file
275338
*
339+
* @link https://www.php.net/manual/en/zookeeper.setlogstream.php
340+
*
276341
* @return bool
277342
*/
278343
public function setLogStream($file)
@@ -284,6 +349,8 @@ public function setLogStream($file)
284349
*
285350
* @param int $level
286351
*
352+
* @link https://www.php.net/manual/en/zookeeper.setdebuglevel.php
353+
*
287354
* @return bool
288355
*/
289356
public static function setDebugLevel($level)
@@ -295,6 +362,8 @@ public static function setDebugLevel($level)
295362
*
296363
* @param bool $trueOrFalse
297364
*
365+
* @link https://www.php.net/manual/en/zookeeper.setdeterministicconnorder.php
366+
*
298367
* @return bool
299368
*/
300369
public static function setDeterministicConnOrder($trueOrFalse)

0 commit comments

Comments
 (0)