Zookeeper
class Zookeeper (View source)
Zookeeper class.
Constants
PERM_READ |
|
PERM_WRITE |
|
PERM_CREATE |
|
PERM_DELETE |
|
PERM_ADMIN |
|
PERM_ALL |
|
EPHEMERAL |
|
SEQUENCE |
|
EXPIRED_SESSION_STATE |
|
AUTH_FAILED_STATE |
|
CONNECTING_STATE |
|
ASSOCIATING_STATE |
|
CONNECTED_STATE |
|
NOTCONNECTED_STATE |
|
CREATED_EVENT |
|
DELETED_EVENT |
|
CHANGED_EVENT |
|
CHILD_EVENT |
|
SESSION_EVENT |
|
NOTWATCHING_EVENT |
|
LOG_LEVEL_ERROR |
|
LOG_LEVEL_WARN |
|
LOG_LEVEL_INFO |
|
LOG_LEVEL_DEBUG |
|
SYSTEMERROR |
|
RUNTIMEINCONSISTENCY |
|
DATAINCONSISTENCY |
|
CONNECTIONLOSS |
|
MARSHALLINGERROR |
|
UNIMPLEMENTED |
|
OPERATIONTIMEOUT |
|
BADARGUMENTS |
|
INVALIDSTATE |
|
NEWCONFIGNOQUORUM
Since: 3.5
|
|
RECONFIGINPROGRESS
Since: 3.5
|
|
OK |
|
APIERROR |
|
NONODE |
|
NOAUTH |
|
BADVERSION |
|
NOCHILDRENFOREPHEMERALS |
|
NODEEXISTS |
|
NOTEMPTY |
|
SESSIONEXPIRED |
|
INVALIDCALLBACK |
|
INVALIDACL |
|
AUTHFAILED |
|
CLOSING |
|
NOTHING |
|
SESSIONMOVED |
|
Methods
Create a handle to used communicate with zookeeper.
Create a handle to used communicate with zookeeper.
Close the zookeeper handle and free up any resources.
Create a node synchronously.
Delete a node in zookeeper synchronously.
Sets the data associated with a node.
Gets the data associated with a node synchronously.
Get children data of a path.
Checks the existence of a node in zookeeper synchronously.
Gets the acl associated with a node synchronously.
Sets the acl associated with a node synchronously.
return the client session id, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE).
Set a watcher function.
Get the state of the zookeeper connection.
Return the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE). This value may change after a server reconnect.
Specify application credentials.
Checks if the current zookeeper connection state can be recovered.
Sets the stream to be used by the library for logging.
Sets the debugging level for the library.
Enable/disable quorum endpoint order randomization.
Details
__construct(string $host = '', callable $watcher_cb = null, int $recv_timeout = 10000)
Create a handle to used communicate with zookeeper.
If the host is provided, attempt to connect.
connect(string $host, callable $watcher_cb = null, int $recv_timeout = 10000)
Create a handle to used communicate with zookeeper.
close()
Close the zookeeper handle and free up any resources.
string
create(string $path, string $value, array $acl, int $flags = null)
Create a node synchronously.
bool
delete(string $path, int $version = -1)
Delete a node in zookeeper synchronously.
bool
set(string $path, string $data, int $version = -1, array $stat = null)
Sets the data associated with a node.
string
get(string $path, callable $watcher_cb = null, array $stat = null, int $max_size = 0)
Gets the data associated with a node synchronously.
array|false
getChildren(string $path, callable $watcher_cb = null)
Get children data of a path.
bool
exists(string $path, callable $watcher_cb = null)
Checks the existence of a node in zookeeper synchronously.
array
getAcl(string $path)
Gets the acl associated with a node synchronously.
bool
setAcl(string $path, int $version, array $acls)
Sets the acl associated with a node synchronously.
int
getClientId()
return the client session id, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE).
bool
setWatcher(callable $watcher_cb)
Set a watcher function.
int
getState()
Get the state of the zookeeper connection.
int
getRecvTimeout()
Return the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE). This value may change after a server reconnect.
bool
addAuth(string $scheme, string $cert, callable $completion_cb = null)
Specify application credentials.
bool
isRecoverable()
Checks if the current zookeeper connection state can be recovered.
bool
setLogStream(resource $file)
Sets the stream to be used by the library for logging.
TODO: might be able to set a stream like php://stderr or something
static bool
setDebugLevel(int $level)
Sets the debugging level for the library.
static bool
setDeterministicConnOrder(bool $trueOrFalse)
Enable/disable quorum endpoint order randomization.