dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add tablesUsed to RevisionStoreDbTest"
[lhc/web/wiklou.git]
/
includes
/
libs
/
HashRing.php
diff --git
a/includes/libs/HashRing.php
b/includes/libs/HashRing.php
index
a4aabcd
..
21558f7
100644
(file)
--- a/
includes/libs/HashRing.php
+++ b/
includes/libs/HashRing.php
@@
-26,16
+26,16
@@
* @since 1.22
*/
class HashRing {
* @since 1.22
*/
class HashRing {
- /** @var
A
rray (location => weight) */
+ /** @var
a
rray (location => weight) */
protected $sourceMap = [];
protected $sourceMap = [];
- /** @var
A
rray (location => (start, end)) */
+ /** @var
a
rray (location => (start, end)) */
protected $ring = [];
/** @var HashRing|null */
protected $liveRing;
protected $ring = [];
/** @var HashRing|null */
protected $liveRing;
- /** @var
A
rray (location => UNIX timestamp) */
+ /** @var
a
rray (location => UNIX timestamp) */
protected $ejectionExpiries = [];
protected $ejectionExpiries = [];
- /** @var int
eger
UNIX timestamp */
+ /** @var int UNIX timestamp */
protected $ejectionNextExpiry = INF;
const RING_SIZE = 268435456; // 2^28
protected $ejectionNextExpiry = INF;
const RING_SIZE = 268435456; // 2^28
@@
-93,7
+93,7
@@
class HashRing {
* Get the location of an item on the ring, as well as the next locations
*
* @param string $item
* Get the location of an item on the ring, as well as the next locations
*
* @param string $item
- * @param int
eger
$limit Maximum number of locations to return
+ * @param int $limit Maximum number of locations to return
* @return array List of locations
*/
public function getLocations( $item, $limit ) {
* @return array List of locations
*/
public function getLocations( $item, $limit ) {
@@
-116,11
+116,12
@@
class HashRing {
// If more locations are requested, wrap-around and keep adding them
reset( $this->ring );
while ( count( $locations ) < $limit ) {
// If more locations are requested, wrap-around and keep adding them
reset( $this->ring );
while ( count( $locations ) < $limit ) {
-
list( $location, ) = each
( $this->ring );
+
$location = key
( $this->ring );
if ( $location === $primaryLocation ) {
break; // don't go in circles
}
$locations[] = $location;
if ( $location === $primaryLocation ) {
break; // don't go in circles
}
$locations[] = $location;
+ next( $this->ring );
}
return $locations;
}
return $locations;
@@
-152,7
+153,7
@@
class HashRing {
* Remove a location from the "live" hash ring
*
* @param string $location
* Remove a location from the "live" hash ring
*
* @param string $location
- * @param int
eger
$ttl Seconds
+ * @param int $ttl Seconds
* @return bool Whether some non-ejected locations are left
*/
public function ejectFromLiveRing( $location, $ttl ) {
* @return bool Whether some non-ejected locations are left
*/
public function ejectFromLiveRing( $location, $ttl ) {
@@
-218,7
+219,7
@@
class HashRing {
* Get the location of an item on the "live" ring, as well as the next locations
*
* @param string $item
* Get the location of an item on the "live" ring, as well as the next locations
*
* @param string $item
- * @param int
eger
$limit Maximum number of locations to return
+ * @param int $limit Maximum number of locations to return
* @return array List of locations
* @throws UnexpectedValueException
*/
* @return array List of locations
* @throws UnexpectedValueException
*/