MediaWiki
REL1_22
|
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. | |
getLocations ($item, $limit) | |
Get the location of an item on the ring, as well as the next clockwise locations. | |
getLocationWeights () | |
Get the map of locations to weight (ignores 0-weight items) | |
newWithoutLocation ($location) | |
Get a new hash ring with a location removed from the ring. | |
Public Attributes | |
const | RING_SIZE = 268435456 |
Protected Attributes | |
Array | $ring = array() |
(location => (start, end)) * | |
Array | $sourceMap = array() |
(location => weight) * |
Convenience class for weighted consistent hash rings.
Definition at line 29 of file HashRing.php.
HashRing::__construct | ( | array $ | map | ) |
array | $map | (location => weight) |
Definition at line 38 of file HashRing.php.
HashRing::getLocation | ( | $ | item | ) |
Get the location of an item on the ring.
string | $item |
Definition at line 76 of file HashRing.php.
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 88 of file HashRing.php.
Get the map of locations to weight (ignores 0-weight items)
Definition at line 122 of file HashRing.php.
HashRing::newWithoutLocation | ( | $ | location | ) |
Get a new hash ring with a location removed from the ring.
string | $location |
Definition at line 132 of file HashRing.php.
Array HashRing::$ring = array() [protected] |
(location => (start, end)) *
Definition at line 31 of file HashRing.php.
Array HashRing::$sourceMap = array() [protected] |
(location => weight) *
Definition at line 30 of file HashRing.php.
const HashRing::RING_SIZE = 268435456 |
Definition at line 33 of file HashRing.php.