X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FHashRing.php;h=be40965e8414a651880f58ffe37ae75fdc3d4dbe;hb=51690a5c79cc2ad8ee35ef8f728ccb1b70298ce1;hp=70ce31d713dd2b7bd518f303cce32a761c4b45e7;hpb=adae996840b9e782f6e14b21c433a83e37c3a74e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/HashRing.php b/includes/libs/HashRing.php index 70ce31d713..be40965e84 100644 --- a/includes/libs/HashRing.php +++ b/includes/libs/HashRing.php @@ -18,7 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @author Aaron Schulz */ /** @@ -32,11 +31,11 @@ class HashRing { /** @var Array (location => (start, end)) */ protected $ring = []; - /** @var Array (location => (start, end)) */ + /** @var HashRing|null */ protected $liveRing; /** @var Array (location => UNIX timestamp) */ protected $ejectionExpiries = []; - /** @var integer UNIX timestamp */ + /** @var int UNIX timestamp */ protected $ejectionNextExpiry = INF; const RING_SIZE = 268435456; // 2^28 @@ -94,7 +93,7 @@ class HashRing { * Get the location of an item on the ring, as well as the next locations * * @param string $item - * @param integer $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 ) { @@ -153,7 +152,7 @@ class HashRing { * Remove a location from the "live" hash ring * * @param string $location - * @param integer $ttl Seconds + * @param int $ttl Seconds * @return bool Whether some non-ejected locations are left */ public function ejectFromLiveRing( $location, $ttl ) { @@ -179,7 +178,7 @@ class HashRing { if ( $this->liveRing === null || $this->ejectionNextExpiry <= $now ) { $this->ejectionExpiries = array_filter( $this->ejectionExpiries, - function( $expiry ) use ( $now ) { + function ( $expiry ) use ( $now ) { return ( $expiry > $now ); } ); @@ -219,7 +218,7 @@ class HashRing { * Get the location of an item on the "live" ring, as well as the next locations * * @param string $item - * @param integer $limit Maximum number of locations to return + * @param int $limit Maximum number of locations to return * @return array List of locations * @throws UnexpectedValueException */