Rewrite HashRing to use consistent hashing
This scheme avoids disruptive re-hashing when a node is
ejected; only the adjectent clockwise sector is affected,
the later taking responsibility for the former. Addition
of new nodes is likewise less disruptive.
When used with MD5, this maps keys the same as libketama.
Also:
* Make HashRing::getLocations() faster by guessing the
sector list index and moving clockwise/counter-clockwise.
* Made HashRing Serializable for more robust storage.
* Allow for different hash functions to be specified.
Note:
* This makes PoolCounterRedis use the new hash scheme.
* Likewise for JobQueueFederated (for job de-duplication).
Switching from one mode to the other will cause some of
duplicated effort from old jobs only temporarily.
Change-Id: Iff432a4e5dc3fb40b2dda70fb3dbe9dda0b74933