/** * @param string $name */ function __construct($name) { $this->name = $name; $this->rabbit = new Rabbit(); $this->notifyQueue = $this->rabbit->init($this->name . '_notify'); $this->requestQueue = $this->rabbit->init($this->name . '_request', 'r'); $this->mongo = new \MongoClient(Config::$get->database->mongodb); $this->dataCollection = $this->mongo->nodes->selectCollection($name . '_storage'); $this->indexCollection = $this->mongo->nodes->selectCollection($name . '_index'); $this->logger = new DefaultLogger('node'); }
/** * Инициализация коммуникации с предшествующим узлом. Подключение очередей и хранилища * @param string Имя узла * @return void */ private function initParent($name) { $this->parentNode['notifyQueue'] = $this->rabbit->init($name . '_notify', 'r'); $this->parentNode['requestQueue'] = $this->rabbit->init($name . '_request'); $this->parentNode['dataCollection'] = $this->mongo->nodes->selectCollection($name . '_storage'); }