/** * @param array $config * @key Scalr_Service_Zookeeper $zookeeper * @key string $path * @key int $quorum * @key int|Scalr_Util_Timeout $timeout * @key bool $autoDelete */ function __construct($config) { foreach ($config as $k => $v) { $this->{$k} = $v; } foreach (array("zookeeper", "path", "quorum") as $k) { if (!$this->{$k}) { throw new Scalr_Service_Zookeeper_Exception(sprintf("'%s' is required config option", $k)); } } if ($this->timeout) { $this->timeout = Scalr_Util_Timeout::get($this->timeout); } }
/** * @param $config * @key Scalr_Service_Zookeeper $zookeeper * @key string $path * @key int $quorum * @key Scalr_Util_Timeout|int $timeout */ function __construct($config) { foreach ($config as $k => $v) { $this->{$k} = $v; } foreach (array("zookeeper", "path", "quorum") as $k) { if (!$this->{$k}) { throw new Scalr_Service_Zookeeper_Exception(sprintf("'%s' is required config option", $k)); } } if ($this->timeout) { $this->timeout = Scalr_Util_Timeout::get($this->timeout); } $this->lock = new Scalr_Service_Zookeeper_Lock(array("zookeeper" => $this->zookeeper, "path" => "{$this->path}/lock")); $this->logger = Logger::getLogger(__CLASS__); }