public class SyncReplicatedConsistentHashFactory extends Object implements ConsistentHashFactory<ReplicatedConsistentHash>
SyncConsistentHashFactory adapted for replicated caches, so that the primary owner of a key
is the same in replicated and distributed caches.| Modifier and Type | Class and Description |
|---|---|
static class |
SyncReplicatedConsistentHashFactory.Externalizer |
| Modifier and Type | Field and Description |
|---|---|
static float |
OWNED_SEGMENTS_ALLOWED_VARIATION |
static float |
PRIMARY_SEGMENTS_ALLOWED_VARIATION |
| Constructor and Description |
|---|
SyncReplicatedConsistentHashFactory() |
| Modifier and Type | Method and Description |
|---|---|
ReplicatedConsistentHash |
create(Hash hashFunction,
int numOwners,
int numSegments,
List<Address> members,
Map<Address,Float> capacityFactors)
Create a new consistent hash instance.
|
ReplicatedConsistentHash |
rebalance(ReplicatedConsistentHash baseCH)
Create a new consistent hash instance, based on an existing instance, but "balanced" according to
the implementation's rules.
|
ReplicatedConsistentHash |
union(ReplicatedConsistentHash ch1,
ReplicatedConsistentHash ch2)
Creates a union of two compatible ConsistentHashes (use the same hashing function and have the same configuration
parameters).
|
ReplicatedConsistentHash |
updateMembers(ReplicatedConsistentHash baseCH,
List<Address> newMembers,
Map<Address,Float> actualCapacityFactors)
Create a new consistent hash instance, based on an existing instance, but with a new list of members.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfromPersistentStatepublic static final float OWNED_SEGMENTS_ALLOWED_VARIATION
public static final float PRIMARY_SEGMENTS_ALLOWED_VARIATION
public ReplicatedConsistentHash create(Hash hashFunction, int numOwners, int numSegments, List<Address> members, Map<Address,Float> capacityFactors)
ConsistentHashFactorycreate in interface ConsistentHashFactory<ReplicatedConsistentHash>hashFunction - The hash function to use on top of the keys' own hashCode() implementation.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 ReplicatedConsistentHash updateMembers(ReplicatedConsistentHash baseCH, List<Address> newMembers, Map<Address,Float> actualCapacityFactors)
ConsistentHashFactoryupdateMembers in interface ConsistentHashFactory<ReplicatedConsistentHash>baseCH - An existing consistent hash instance, should not be nullnewMembers - 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.ConsistentHash instance, or baseCH if the existing instance
does not need any changes.public ReplicatedConsistentHash rebalance(ReplicatedConsistentHash baseCH)
ConsistentHashFactoryrebalance(rebalance(ch)) must be equivalent to rebalance(ch).rebalance in interface ConsistentHashFactory<ReplicatedConsistentHash>baseCH - An existing consistent hash instance, should not be nullConsistentHash instance, or baseCH if the existing instance
does not need any changes.public ReplicatedConsistentHash union(ReplicatedConsistentHash ch1, ReplicatedConsistentHash ch2)
ConsistentHashFactoryunion in interface ConsistentHashFactory<ReplicatedConsistentHash>Copyright © 2025 JBoss, a division of Red Hat. All rights reserved.