MediaWiki
1.23.2
|
Convenience class for weighted consistent hash rings. More...
Public Member Functions | |
__construct (array $map) | |
getLocation ( $item) | |
Get the location of an item on the ring. More... | |
getLocations ( $item, $limit) | |
Get the location of an item on the ring, as well as the next clockwise locations. More... | |
getLocationWeights () | |
Get the map of locations to weight (ignores 0-weight items) More... | |
newWithoutLocation ( $location) | |
Get a new hash ring with a location removed from the ring. More... | |
Public Attributes | |
const | RING_SIZE = 268435456 |
Protected Attributes | |
Array | $ring = array() |
(location => (start, end)) * More... | |
Array | $sourceMap = array() |
(location => weight) * More... | |
Convenience class for weighted consistent hash rings.
Definition at line 29 of file HashRing.php.
HashRing::__construct | ( | array | $map | ) |
HashRing::getLocation | ( | $item | ) |
Get the location of an item on the ring.
string | $item |
Definition at line 78 of file HashRing.php.
References getLocations().
Referenced by JobQueueFederated\tryJobInsertions().
HashRing::getLocations | ( | $item, | |
$limit | |||
) |
Get the location of an item on the ring, as well as the next clockwise locations.
string | $item | |
integer | $limit | Maximum number of locations to return |
Definition at line 91 of file HashRing.php.
References $limit, array(), as, and list.
Referenced by getLocation().
HashRing::getLocationWeights | ( | ) |
Get the map of locations to weight (ignores 0-weight items)
Definition at line 126 of file HashRing.php.
References $sourceMap.
Referenced by JobQueueFederated\tryJobInsertions().
HashRing::newWithoutLocation | ( | $location | ) |
Get a new hash ring with a location removed from the ring.
string | $location |
Definition at line 136 of file HashRing.php.
References $sourceMap.
Referenced by JobQueueFederated\tryJobInsertions().
|
protected |
(location => (start, end)) *
Definition at line 31 of file HashRing.php.
|
protected |
(location => weight) *
Definition at line 30 of file HashRing.php.
Referenced by getLocationWeights(), and newWithoutLocation().
const HashRing::RING_SIZE = 268435456 |
Definition at line 33 of file HashRing.php.
Referenced by __construct().