private function _gen_init_meta_ack() { $ack = new InitMetaAckFrame(); $ack->status = 0; $ack->meta_name = 'meta'; $ack->store(); $data = $ack->buffer(); $err_ack = new UninitMetaAckFrame(); $err_ack->status = 0; $err_ack->store(); $err_data = $err_ack->buffer(); return array('good' => $data, 'bad' => $err_data); }
/** * Initialize the meta on the meta agent * @param $conf : array of meta parameters * @return true on success or false on failure */ private function _init_meta($meta_params) { // create init_meta_command $cmd = new InitMetaFrame(); if (!$cmd->pack($meta_params)) { $this->last_error_message = "_init_meta error"; return false; } // send $res_body = $this->_request($cmd); if (null === $res_body) { $this->last_error_message = "_init_meta no ack"; return false; } // parse ack $ack = new InitMetaAckFrame(); if (!$ack->load($res_body)) { $this->last_error_message = '_init_meta error ack'; return false; } $this->meta_name = $ack->meta_name; // 成功则得到meta name return true; }