|
@@ -80,7 +80,7 @@ class HashRing implements IDistributionStrategy {
|
|
|
|
|
|
protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightRatio) {
|
|
|
$nodeObject = $node['object'];
|
|
|
- $nodeHash = (string) $nodeObject;
|
|
|
+ $nodeHash = $this->getNodeHash($nodeObject);
|
|
|
$replicas = (int) round($weightRatio * $totalNodes * $replicas);
|
|
|
for ($i = 0; $i < $replicas; $i++) {
|
|
|
$key = crc32("$nodeHash:$i");
|
|
@@ -88,6 +88,10 @@ class HashRing implements IDistributionStrategy {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ protected function getNodeHash($nodeObject) {
|
|
|
+ return (string) $nodeObject;
|
|
|
+ }
|
|
|
+
|
|
|
public function generateKey($value) {
|
|
|
return crc32($value);
|
|
|
}
|