public function write($key, $value)
{
// what are we doing?
$log = usingLog()->startAction("set '{$key}' to '{$value}' in Zookeeper");
// make sure the path exists
$this->ensurePathToKeyExists($key);
// now we can safely set the key itself
if (!$this->zk->exists($key)) {
if (!$this->zk->create($key, $value, $this->default_acl)) {
throw new E5xx_ActionFailed(__METHOD__);
}
} else {
if (!$this->zk->set($key, $value)) {
throw new E5xx_ActionFailed(__METHOD__);
}
}
// all done
$log->endAction();
}