getHello() public method

Get the node's last HELLO response
public getHello ( ) : array
return array
Exemplo n.º 1
0
 /**
  * Reveal the whole Disque cluster from a node HELLO response
  *
  * The HELLO response from a Disque node contains addresses of all other
  * nodes in the cluster. We want to learn about them and save them, so that
  * we can switch to them later, if needed.
  *
  * @param Node $node The current node
  */
 private function revealClusterFromHello(Node $node)
 {
     $hello = $node->getHello();
     $revealedNodes = [];
     foreach ($hello[HelloResponse::NODES] as $node) {
         $id = $node[HelloResponse::NODE_ID];
         $revealedNode = $this->revealNodeFromHello($id, $node);
         // Update or set the node's priority as determined by Disque
         $priority = $node[HelloResponse::NODE_PRIORITY];
         $revealedNode->setPriority($priority);
         $revealedNodes[$id] = $revealedNode;
     }
     $this->nodes = $revealedNodes;
 }