|
MediaWiki
master
|
Convenience class for weighted consistent hash rings. More...
Public Member Functions | |
| __construct (array $map) | |
| ejectFromLiveRing ($location, $ttl) | |
| Remove a location from the "live" hash ring. More... | |
| getLiveLocation ($item) | |
| Get the location of an item on the "live" ring. More... | |
| getLiveLocations ($item, $limit) | |
| Get the location of an item on the "live" ring, as well as the next locations. More... | |
| getLiveLocationWeights () | |
| Get the map of "live" locations to weight (ignores 0-weight items) More... | |
| getLiveRing () | |
| Get the "live" hash ring (which does not include ejected locations) More... | |
| 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 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 | $ejectionExpiries = [] |
| (location => UNIX timestamp) More... | |
| integer | $ejectionNextExpiry = INF |
| UNIX timestamp. More... | |
| Array | $liveRing |
| (location => (start, end)) More... | |
| Array | $ring = [] |
| (location => (start, end)) More... | |
| Array | $sourceMap = [] |
| (location => weight) More... | |
Convenience class for weighted consistent hash rings.
Definition at line 29 of file HashRing.php.
| HashRing::__construct | ( | array | $map | ) |
| HashRing::ejectFromLiveRing | ( | $location, | |
| $ttl | |||
| ) |
Remove a location from the "live" hash ring.
| string | $location | |
| integer | $ttl | Seconds |
Definition at line 159 of file HashRing.php.
Referenced by JobQueueFederated\tryJobInsertions().
| HashRing::getLiveLocation | ( | $item | ) |
Get the location of an item on the "live" ring.
| string | $item |
| UnexpectedValueException |
Definition at line 214 of file HashRing.php.
References getLiveRing().
Referenced by JobQueueFederated\tryJobInsertions().
| HashRing::getLiveLocations | ( | $item, | |
| $limit | |||
| ) |
Get the location of an item on the "live" ring, as well as the next locations.
| string | $item | |
| integer | $limit | Maximum number of locations to return |
| UnexpectedValueException |
Definition at line 226 of file HashRing.php.
References $limit, and getLiveRing().
| HashRing::getLiveLocationWeights | ( | ) |
Get the map of "live" locations to weight (ignores 0-weight items)
| UnexpectedValueException |
Definition at line 236 of file HashRing.php.
References getLiveRing().
Referenced by JobQueueFederated\tryJobInsertions().
| HashRing::getLiveRing | ( | ) |
Get the "live" hash ring (which does not include ejected locations)
| UnexpectedValueException |
Definition at line 177 of file HashRing.php.
References $liveRing, and use.
Referenced by JobQueueFederated\doBatchPush(), getLiveLocation(), getLiveLocations(), and getLiveLocationWeights().
| HashRing::getLocation | ( | $item | ) |
Get the location of an item on the ring.
| string | $item |
Definition at line 87 of file HashRing.php.
References getLocations().
| HashRing::getLocations | ( | $item, | |
| $limit | |||
| ) |
Get the location of an item on the ring, as well as the next locations.
| string | $item | |
| integer | $limit | Maximum number of locations to return |
Definition at line 100 of file HashRing.php.
References $limit, as, and list.
Referenced by getLocation().
| HashRing::getLocationWeights | ( | ) |
Get the map of locations to weight (ignores 0-weight items)
Definition at line 135 of file HashRing.php.
References $sourceMap.
| HashRing::newWithoutLocation | ( | $location | ) |
Get a new hash ring with a location removed from the ring.
| string | $location |
Definition at line 145 of file HashRing.php.
References $sourceMap.
|
protected |
(location => UNIX timestamp)
Definition at line 38 of file HashRing.php.
|
protected |
UNIX timestamp.
Definition at line 40 of file HashRing.php.
|
protected |
|
protected |
(location => (start, end))
Definition at line 33 of file HashRing.php.
|
protected |
(location => weight)
Definition at line 31 of file HashRing.php.
Referenced by getLocationWeights(), and newWithoutLocation().
| const HashRing::RING_SIZE = 268435456 |
Definition at line 42 of file HashRing.php.