public function __construct(int $groupCount)
{
$this->_groupCount = $groupCount;
$map = [];
for ($group = 0; $group < $groupCount; $group++) {
foreach (self::get_hashes_for_group($group) as $hash) {
$map[$hash] = $group;
}
}
$hashRingIds = [];
ksort($map);
foreach ($map as $key => $group) {
$hashRingIds[] = $key;
$hashRingGroups[] = $group;
}
// ... and make the map wrap around.
$hashRingIds[] = self::MAX - 1;
$hashRingGroups[] = reset($map);
$this->_hashRingIds = $hashRingIds;
$this->_hashRingGroups = $hashRingGroups;
}