src/Cluster/Distributor/HashRing.php
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;
        }
    }
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;
        }
    }
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 ; } }
Implements the logic needed to add a node to the hashring.

@param array $ring        Source hashring.
@param mixed $node        Node object to be added.
@param int   $totalNodes  Total number of nodes.
@param int   $replicas    Number of replicas in the ring.
@param float $weightRatio Weight ratio for the node.
Implements the logic needed to add a node to the hashring .