コード例 #1
0
ファイル: NodeRegistry.php プロジェクト: mheydt/scalr
 function nodesCapacity()
 {
     try {
         return $this->zookeeper->get($this->path)->numChildren;
     } catch (Scalr_Service_Zookeeper_Exception $e) {
         if ($e->getCode() == Scalr_Service_Zookeeper_Exception::NOT_FOUND) {
             return 0;
         }
         throw $e;
     }
 }
コード例 #2
0
ファイル: Queue.php プロジェクト: rakesh-mohanta/scalr
 function capacity()
 {
     $this->init();
     if ($this->children) {
         return count($this->children);
     } else {
         $stat = $this->zookeeper->get($this->path);
         return $stat->numChildren;
     }
 }
コード例 #3
0
ファイル: Election.php プロジェクト: sacredwebsite/scalr
 private function getStatus()
 {
     try {
         $stat = $this->zookeeper->get("{$this->path}/status");
         return unserialize(base64_decode($stat->data64));
     } catch (Scalr_Service_Zookeeper_Exception $e) {
         if ($e->getCode() == Scalr_Service_Zookeeper_Exception::NOT_FOUND) {
             return self::STATUS_NOTSET;
         }
         throw $e;
     }
 }