public class ScatteredConsistentHashFactory extends AbstractConsistentHashFactory<ScatteredConsistentHash>
DefaultConsistentHashFactory
.Modifier and Type | Class and Description |
---|---|
protected static class |
ScatteredConsistentHashFactory.Builder |
static class |
ScatteredConsistentHashFactory.Externalizer |
Constructor and Description |
---|
ScatteredConsistentHashFactory() |
Modifier and Type | Method and Description |
---|---|
ScatteredConsistentHash |
create(int numOwners,
int numSegments,
List<Address> members,
Map<Address,Float> capacityFactors)
Create a new consistent hash instance.
|
boolean |
equals(Object other) |
ScatteredConsistentHash |
fromPersistentState(ScopedPersistentState state)
Recreates a ConsistentHash from a previously stored persistent state.
|
int |
hashCode() |
ScatteredConsistentHash |
rebalance(ScatteredConsistentHash baseCH)
Create a new consistent hash instance, based on an existing instance, but balanced according to
the implementation's rules.
|
protected void |
rebalanceBuilder(ScatteredConsistentHashFactory.Builder builder) |
protected void |
replacePrimaryOwners(ScatteredConsistentHashFactory.Builder builder) |
ScatteredConsistentHash |
union(ScatteredConsistentHash dch1,
ScatteredConsistentHash dch2)
Merges two consistent hash objects that have the same number of segments, numOwners and hash function.
|
ScatteredConsistentHash |
updateMembers(ScatteredConsistentHash baseCH,
List<Address> actualMembers,
Map<Address,Float> actualCapacityFactors)
Leavers are removed and segments without owners are assigned new owners.
|
checkCapacityFactors, findNewPrimaryOwner, findWorstPrimaryOwner
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
create
public ScatteredConsistentHash create(int numOwners, int numSegments, List<Address> members, Map<Address,Float> capacityFactors)
ConsistentHashFactory
numOwners
- The ideal number of owners for each key. The created consistent hash
can have more or less owners, but each key will have at least one owner.numSegments
- Number of hash-space segments. The implementation may round up the number
of segments for performance, or may ignore the parameter altogether.members
- A list of addresses representing the new cache members.capacityFactors
- The capacity factor of each member. Determines the relative capacity of each node compared
to the others. The implementation may ignore this parameter.
If null
, all the members are assumed to have a capacity factor of 1.public ScatteredConsistentHash fromPersistentState(ScopedPersistentState state)
ConsistentHashFactory
PersistentUUID
s instead so they will need to be replacedstate
- the state to restorepublic ScatteredConsistentHash updateMembers(ScatteredConsistentHash baseCH, List<Address> actualMembers, Map<Address,Float> actualCapacityFactors)
baseCH
- An existing consistent hash instance, should not be null
actualMembers
- A list of addresses representing the new cache members.actualCapacityFactors
- The capacity factor of each member. Determines the relative capacity of each node compared
to the others. The implementation may ignore this parameter.
If null
, all the members are assumed to have a capacity factor of 1.public ScatteredConsistentHash rebalance(ScatteredConsistentHash baseCH)
ConsistentHashFactory
baseCH
- An existing consistent hash instance, should not be null
ConsistentHash
instance, or baseCH
if the existing instance
does not need any changes.public ScatteredConsistentHash union(ScatteredConsistentHash dch1, ScatteredConsistentHash dch2)
protected void rebalanceBuilder(ScatteredConsistentHashFactory.Builder builder)
protected void replacePrimaryOwners(ScatteredConsistentHashFactory.Builder builder)
Copyright © 2021 JBoss by Red Hat. All rights reserved.