class FlexiHash{private $_replicas = 200;private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
FlexiHash{private $_replicas = 200;private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_replicas = 200;private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_replicas = 200;private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= 200;private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_hasher = null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= null;private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_targetCount = 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= 0;private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_positionToTarget = array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
array();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
();private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_targetToPositions = array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
array();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
();private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
private $_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$_positionToTargetSorted = false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= false;public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function __construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
__construct(FlexiHash_Hasher $hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$hasher=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
=null, $replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$replicas = null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= null){// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// hash方法$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_hasher = $hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$hasher?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
?$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$hasher: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
: new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
new FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
FlexiHash_Crc32Hasher();// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// 虚拟节点的个数if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
if (!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
(!empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
empty($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$replicas)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
)){$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_replicas = $replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$replicas;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
addTarget($target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
if (isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
(isset($this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
])) {throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
throw new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
new FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
FlexiHash_Exception("Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
"Target $target already exists.");}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
);}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
] = array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
array();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
();for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
for ($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$i = 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= 0; $i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$i < $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
< $this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_replicas; $i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$i++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
++) {// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// 根据规定的方法hash$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$position = $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= $this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_hasher->hash($target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
.$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$i);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
);// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// 虚拟节点对应的真实的节点$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_positionToTarget[$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$position] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
] = $target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// 真实节点包含的虚拟节点$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
][] = $position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$position;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_positionToTargetSorted = false;// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
// 真实节点个数$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetCount++;return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
return $this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
addTargets($targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$targets){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
foreach ($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$targets as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
as $target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->addTarget($target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
);}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
return $this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
removeTarget($target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
if (!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
(!isset($this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
])){throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
throw new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
new FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
FlexiHash_Exception("target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
"target $target does not existn");}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
);}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
foreach($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
] as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
as $position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$position){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
unset($this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_positionToTarget[$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$position]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
]);}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
unset($this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions[$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$target]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
]);$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetCount--;return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
return $this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
;}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
getAllTargets(){return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
return array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
array_keys($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->_targetToPositions);}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
lookup($resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$resource){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$targets = $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
= $this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$this->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
->lookupList($resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$resource, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
, 1);if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
if (empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
(empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
empty($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
($targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$targets)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
)){throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
throw new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
new FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
FlexiHash_Exception("no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
"no targets exist");}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
);}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
return $targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$targets[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
[0];}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
}public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
public function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
function lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
lookupList($resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$resource, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
, $requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$requestedCount){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
){if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
if (!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
(!$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
$requestedCount) {throw new FlexiHash_Exception('Invalid count requested'
) {throw new FlexiHash_Exception('Invalid count requested'
throw new FlexiHash_Exception('Invalid count requested'
new FlexiHash_Exception('Invalid count requested'
FlexiHash_Exception('Invalid count requested'
'Invalid count requested'