ZooKeeper
PHP Manual

The Zookeeper class

(PECL zookeeper >= 0.1.0)

简介

Represents ZooKeeper session.

类摘要

Zookeeper {
/* 方法 */
public __construct ([ string $host = '' [, callable $watcher_cb = NULL [, int $recv_timeout = 10000 ]]] )
public bool addAuth ( string $scheme , string $cert [, callable $completion_cb = NULL ] )
public void close ( void )
public void connect ( string $host [, callable $watcher_cb = NULL [, int $recv_timeout = 10000 ]] )
public string create ( string $path , string $value , array $acls [, int $flags = NULL ] )
public bool delete ( string $path [, int $version = -1 ] )
public bool exists ( string $path [, callable $watcher_cb = NULL ] )
public string get ( string $path [, callable $watcher_cb = NULL [, array &$stat = NULL [, int $max_size = 0 ]]] )
public array getAcl ( string $path )
public array getChildren ( string $path [, callable $watcher_cb = NULL ] )
public int getClientId ( void )
public ZookeeperConfig getConfig ( void )
public int getRecvTimeout ( void )
public int getState ( void )
public bool isRecoverable ( void )
public bool set ( string $path , string $value [, int $version = -1 [, array &$stat = NULL ]] )
public bool setAcl ( string $path , int $version , array $acl )
public static bool setDebugLevel ( int $logLevel )
public static bool setDeterministicConnOrder ( bool $yesOrNo )
public bool setLogStream ( resource $stream )
public bool setWatcher ( callable $watcher_cb )
/* 常量 */
const integer PERM_READ = 1 ;
const integer PERM_WRITE = 2 ;
const integer PERM_CREATE = 4 ;
const integer PERM_DELETE = 8 ;
const integer PERM_ADMIN = 16 ;
const integer PERM_ALL = 31 ;
const integer LOG_LEVEL_ERROR = 1 ;
const integer LOG_LEVEL_WARN = 2 ;
const integer LOG_LEVEL_INFO = 3 ;
const integer LOG_LEVEL_DEBUG = 4 ;
const integer EXPIRED_SESSION_STATE = -112 ;
const integer AUTH_FAILED_STATE = -113 ;
const integer CONNECTING_STATE = 1 ;
const integer ASSOCIATING_STATE = 2 ;
const integer CONNECTED_STATE = 3 ;
const integer READONLY_STATE = 5 ;
const integer NOTCONNECTED_STATE = 999 ;
}

预定义常量

ZooKeeper Permissions

Zookeeper::PERM_READ

Can read nodes value and list its children

Zookeeper::PERM_WRITE

Can set the nodes value

Zookeeper::PERM_CREATE

Can create children

Zookeeper::PERM_DELETE

Can delete children

Zookeeper::PERM_ADMIN

Can execute set_acl()

Zookeeper::PERM_ALL

All of the above flags ORd together

ZooKeeper Log Levels

Zookeeper::LOG_LEVEL_ERROR

Outputs only error mesages

Zookeeper::LOG_LEVEL_WARN

Outputs errors/warnings

Zookeeper::LOG_LEVEL_INFO

Outputs big action messages besides errors/warnings

Zookeeper::LOG_LEVEL_DEBUG

Outputs all

ZooKeeper States

Zookeeper::EXPIRED_SESSION_STATE

Connected but session expired

Zookeeper::AUTH_FAILED_STATE

Connected but auth failed

Zookeeper::CONNECTING_STATE

Connecting

Zookeeper::ASSOCIATING_STATE

Associating

Zookeeper::CONNECTED_STATE

Connected

Zookeeper::READONLY_STATE

TODO: help us improve this extension.

Zookeeper::NOTCONNECTED_STATE

Connection failed

Table of Contents


ZooKeeper
PHP Manual