[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/libs/ -> HashRing.php (summary)

Convenience class for weighted consistent hash rings. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Aaron Schulz
File Size: 239 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HashRing:: (10 methods):
  __construct()
  getLocation()
  getLocations()
  getLocationWeights()
  newWithoutLocation()
  ejectFromLiveRing()
  getLiveRing()
  getLiveLocation()
  getLiveLocations()
  getLiveLocationWeights()


Class: HashRing  - X-Ref

Convenience class for weighted consistent hash rings

__construct( array $map )   X-Ref

param: array $map (location => weight)

getLocation( $item )   X-Ref
Get the location of an item on the ring

param: string $item
return: string Location

getLocations( $item, $limit )   X-Ref
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
return: array List of locations

getLocationWeights()   X-Ref
Get the map of locations to weight (ignores 0-weight items)

return: array

newWithoutLocation( $location )   X-Ref
Get a new hash ring with a location removed from the ring

param: string $location
return: HashRing|bool Returns false if no non-zero weighted spots are left

ejectFromLiveRing( $location, $ttl )   X-Ref
Remove a location from the "live" hash ring

param: string $location
param: integer $ttl Seconds
return: bool Whether some non-ejected locations are left

getLiveRing()   X-Ref
Get the "live" hash ring (which does not include ejected locations)

return: HashRing

getLiveLocation( $item )   X-Ref
No description

getLiveLocations( $item )   X-Ref
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
return: array List of locations

getLiveLocationWeights()   X-Ref
Get the map of "live" locations to weight (ignores 0-weight items)

return: array



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1