public final class SegmentConsistentHash extends Object implements ConsistentHash
Constructor and Description |
---|
SegmentConsistentHash() |
Modifier and Type | Method and Description |
---|---|
int |
getNormalizedHash(Object object)
Computes hash code of a given object, and then normalizes it to ensure a positive
value is always returned.
|
int |
getNumSegments() |
Map<SocketAddress,Set<Integer>> |
getPrimarySegmentsByServer() |
int |
getSegment(Object key) |
SocketAddress[][] |
getSegmentOwners() |
Map<SocketAddress,Set<Integer>> |
getSegmentsByServer() |
SocketAddress |
getServer(Object key) |
void |
init(Map<SocketAddress,Set<Integer>> servers2Hash,
int numKeyOwners,
int hashSpace) |
void |
init(SocketAddress[][] segmentOwners,
int numSegments) |
public void init(Map<SocketAddress,Set<Integer>> servers2Hash, int numKeyOwners, int hashSpace)
init
in interface ConsistentHash
public void init(SocketAddress[][] segmentOwners, int numSegments)
public SocketAddress getServer(Object key)
getServer
in interface ConsistentHash
public int getSegment(Object key)
public int getNormalizedHash(Object object)
ConsistentHash
getNormalizedHash
in interface ConsistentHash
object
- to hashpublic Map<SocketAddress,Set<Integer>> getSegmentsByServer()
getSegmentsByServer
in interface ConsistentHash
public Map<SocketAddress,Set<Integer>> getPrimarySegmentsByServer()
getPrimarySegmentsByServer
in interface ConsistentHash
public int getNumSegments()
public SocketAddress[][] getSegmentOwners()
Copyright © 2021 JBoss by Red Hat. All rights reserved.