Predis\Cluster\Distributor\HashRing::addNodeToRing PHP 메소드

addNodeToRing() 보호된 메소드

Implements the logic needed to add a node to the hashring.
protected addNodeToRing ( array &$ring, mixed $node, integer $totalNodes, integer $replicas, float $weightRatio )
$ring array Source hashring.
$node mixed Node object to be added.
$totalNodes integer Total number of nodes.
$replicas integer Number of replicas in the ring.
$weightRatio float Weight ratio for the node.
    protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightRatio)
    {
        $nodeObject = $node['object'];
        $nodeHash = $this->getNodeHash($nodeObject);
        $replicas = (int) round($weightRatio * $totalNodes * $replicas);
        for ($i = 0; $i < $replicas; ++$i) {
            $key = crc32("{$nodeHash}:{$i}");
            $ring[$key] = $nodeObject;
        }
    }