/** * Create a node on ZooKeeper at the given path * * @param string $path The path to the node * @param string $value The value to assign to the new node * @param array $params Optional parameters for the Zookeeper node. * By default, a public node is created * * @return string the path to the newly created node or null on failure */ public function makeNode($path, $value, array $params = array()) { if (empty($params)) { $params = array(array('perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone')); } return $this->zookeeper->create($path, $value, $params); }
/** * Create null permanent node helper. * @param String $path */ private function createEphemeralNode($path, $value) { $this->zk->create($path, $value, $params = array(array('perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone')), \Zookeeper::EPHEMERAL); }
/** * Create parent node, if needed * * @param string $nodePath */ private function createParentIfNeeded($nodePath) { if (!$this->zk->exists($nodePath)) { $this->zk->create($nodePath, 'Cruftflake machines', array(array('perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone'))); } }
/** * Create a node on ZooKeeper at the given path * * @param string $path The path to the node * @param mixed $value The value to assign to the new node * * @return bool */ protected function makeZkNode($path, $value) { $params = array(array('perms' => Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone')); return $this->zookeeper->create($path, $value, $params); }