Example #1
0
 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;
     }
 }
Example #2
0
 function capacity()
 {
     $this->init();
     if ($this->children) {
         return count($this->children);
     } else {
         $stat = $this->zookeeper->get($this->path);
         return $stat->numChildren;
     }
 }
Example #3
0
 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;
     }
 }