5.7.24. vlcp.utils.zkclient¶
Note
This document is generated from the source file.
Created on 2016/9/22
author: | hubo |
---|
-
class
vlcp.utils.zkclient.
ZooKeeperClient
(container, serverlist=None, chroot=None, protocol=None, readonly=False, restart_session=True)¶ ZooKeeper client to send requests to a cluster
-
__init__
(container, serverlist=None, chroot=None, protocol=None, readonly=False, restart_session=True)¶ Initialize self. See help(type(self)) for accurate signature.
-
get_last_watch_zxid
()¶ Return the latest zxid seen from servers
-
get_last_zxid
()¶ Return the latest zxid seen from servers
-
requests
(requests, container, timeout=None, session_lock=None, callback=None, priority=0)¶ - similar to vlcp.protocol.zookeeper.ZooKeeper.requests, but:
- Returns an extra item watchers, which is a list of objects corresponding to each request. if the request has watch=True, the corresponding object is a RoutineFuture object; if the request has watch=False or does not support watch, the corresponding object is None. Use watcher.wait() to get the watch event. Use watcher.close() to discard the watcher.
- If the connection is lost during requests, this method waits for reconnecting until timeout, session expires or the response of a request which is not read-only is lost.
Parameters: - requests – sequence of request
- container – container of current routine
- timeout – if not None, wait only for specified time. Notice that it is not an exact limit, it won’t stop the execution unless the connection is lost
- session_lock – if not None, only execute if the session_id == session_lock
- callback – if not None, callback(request, response) is called immediately after any response is received
Returns: (result, lost_responses, retry_requests, watchers) tuple, the first three are the same as ZooKeeper.requests, the last item watchers is a list of RoutineFuture objects
-
reset
()¶ Discard current session and start a new one
-
watch_path
(path, watch_type, container=None)¶ Watch the specified path as specified type
-
-
exception
vlcp.utils.zkclient.
ZooKeeperIllegalPathException
¶
-
class
vlcp.utils.zkclient.
ZooKeeperRestoreWatches
(*args, **kwargs)¶
-
class
vlcp.utils.zkclient.
ZooKeeperSessionStateChanged
(*args, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
-
vlcp.utils.zkclient.
random
() → x in the interval [0, 1).¶