GoLang Zookeeper::create

request it (293)
GoLang replacement for PHP's Zookeeper::create [edit | history]

Do you know a GoLang replacement for PHP's Zookeeper::create? Write it!

PHP Zookeeper::create

PHP original manual for Zookeeper::create [ show | php.net ]


(PECL zookeeper >= 0.1.0)

Zookeeper::createCreate a node synchronously


public string Zookeeper::create ( string $path , string $value , array $acls [, int $flags = NULL ] )

This method will create a node in ZooKeeper. A node can only be created if it does not already exists. The Create Flags affect the creation of nodes. If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the client session goes away. If the ZOO_SEQUENCE flag is set, a unique monotonically increasing sequence number is appended to the path name.



The name of the node. Expressed as a file name with slashes separating ancestors of the node.


The data to be stored in the node.


The initial ACL of the node. The ACL must not be null or empty.


this parameter can be set to 0 for normal create or an OR of the Create Flags

Return Values

Returns the path of the new node (this might be different than the supplied path because of the ZOO_SEQUENCE flag) on success, and false on failure.


This method emits PHP error/warning when parameters count or types are wrong or fail to create node.


Since version 0.3.0, this method emits ZookeeperException and it's derivatives.


Example #1 Zookeeper::create() example

Create a new node.

= new Zookeeper('locahost:2181');
$aclArray = array(
'perms'  => Zookeeper::PERM_ALL,
'scheme' => 'world',
'id'     => 'anyone',
$path '/path/to/newnode';
$realPath $zookeeper->create($pathnull$aclArray);
if (

The above example will output:


See Also