public abstract class AbstractConsistentHash extends Object implements ConsistentHash
Modifier and Type | Field and Description |
---|---|
protected float[] |
capacityFactors |
protected List<Address> |
members
The membership of the cache topology that uses this CH.
|
protected static String |
STATE_CAPACITY_FACTOR |
protected static String |
STATE_CAPACITY_FACTORS |
protected static String |
STATE_NUM_SEGMENTS |
Modifier | Constructor and Description |
---|---|
protected |
AbstractConsistentHash(int numSegments,
List<Address> members,
float[] capacityFactors) |
protected |
AbstractConsistentHash(int numSegments,
List<Address> members,
Map<Address,Float> capacityFactors) |
protected |
AbstractConsistentHash(ScopedPersistentState state) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkSameHashAndSegments(AbstractConsistentHash dch2) |
Map<Address,Float> |
getCapacityFactors()
The capacity factor of each member.
|
List<Address> |
getMembers()
Should return the addresses of the nodes used to create this consistent hash.
|
protected static void |
mergeLists(List<Address> dest,
List<Address> src)
Adds all elements from
src list that do not already exist in dest list to the latter. |
protected static float[] |
parseCapacityFactors(ScopedPersistentState state) |
protected static Hash |
parseHashFunction(ScopedPersistentState state) |
protected static List<Address> |
parseMembers(ScopedPersistentState state) |
protected static int |
parseNumSegments(ScopedPersistentState state) |
protected Map<Address,Float> |
remapCapacityFactors(UnaryOperator<Address> remapper) |
protected List<Address> |
remapMembers(UnaryOperator<Address> remapper) |
void |
toScopedState(ScopedPersistentState state)
Writes this ConsistentHash to the specified scoped state.
|
protected Map<Address,Float> |
unionCapacityFactors(AbstractConsistentHash ch2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNumSegments, getPrimarySegmentsForOwner, getRoutingTableAsString, getSegmentsForOwner, isReplicated, isSegmentLocalToNode, locateOwnersForSegment, locatePrimaryOwnerForSegment, remapAddresses
protected static final String STATE_CAPACITY_FACTOR
protected static final String STATE_CAPACITY_FACTORS
protected static final String STATE_NUM_SEGMENTS
protected final List<Address> members
protected final float[] capacityFactors
protected AbstractConsistentHash(int numSegments, List<Address> members, Map<Address,Float> capacityFactors)
protected AbstractConsistentHash(int numSegments, List<Address> members, float[] capacityFactors)
protected AbstractConsistentHash(ScopedPersistentState state)
protected static int parseNumSegments(ScopedPersistentState state)
protected static List<Address> parseMembers(ScopedPersistentState state)
protected static Hash parseHashFunction(ScopedPersistentState state)
protected static float[] parseCapacityFactors(ScopedPersistentState state)
public void toScopedState(ScopedPersistentState state)
ConsistentHash
PersistentUUID
stoScopedState
in interface ConsistentHash
state
- the state to which this ConsistentHash will be writtenpublic List<Address> getMembers()
ConsistentHash
getMembers
in interface ConsistentHash
protected static void mergeLists(List<Address> dest, List<Address> src)
src
list that do not already exist in dest
list to the latter.dest
- List where elements are addedsrc
- List of elements to add - this is never modifiedpublic Map<Address,Float> getCapacityFactors()
ConsistentHash
null
, all the members are assumed to have a capacity factor of 1.getCapacityFactors
in interface ConsistentHash
protected Map<Address,Float> unionCapacityFactors(AbstractConsistentHash ch2)
protected void checkSameHashAndSegments(AbstractConsistentHash dch2)
protected Map<Address,Float> remapCapacityFactors(UnaryOperator<Address> remapper)
protected List<Address> remapMembers(UnaryOperator<Address> remapper)
Copyright © 2021 JBoss by Red Hat. All rights reserved.