Interface ConsistentHashFactory<CH extends ConsistentHash>
-
@Deprecated public interface ConsistentHashFactory<CH extends ConsistentHash>
Deprecated.Since 11.0. Will be removed in 14.0, the segment allocation will no longer be customizable.Factory forConsistentHash
instances.We say a consistent hash
ch
is balanced iifrebalance(ch).equals(ch)
.The consistent hashes created by
create(int, int, List, Map)
must be balanced, but the ones created byupdateMembers(ConsistentHash, List, Map)
andunion(ConsistentHash, ConsistentHash)
will likely be unbalanced.- Since:
- 5.2
- Author:
- Dan Berindei
- See Also:
- Non-BlockingStateTransferV2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CH
create(int numOwners, int numSegments, List<org.infinispan.remoting.transport.Address> members, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.Create a new consistent hash instance.default CH
create(Hash hashFunction, int numOwners, int numSegments, List<org.infinispan.remoting.transport.Address> members, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.since 11.0.default CH
fromPersistentState(ScopedPersistentState state)
Deprecated.Recreates a ConsistentHash from a previously stored persistent state.CH
rebalance(CH baseCH)
Deprecated.Create a new consistent hash instance, based on an existing instance, but balanced according to the implementation's rules.CH
union(CH ch1, CH ch2)
Deprecated.Creates a union of two compatible ConsistentHashes (use the same hashing function and have the same configuration parameters).CH
updateMembers(CH baseCH, List<org.infinispan.remoting.transport.Address> newMembers, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.Updates an existing consistent hash instance to remove owners that are not in thenewMembers
list.
-
-
-
Method Detail
-
create
@Deprecated default CH create(Hash hashFunction, int numOwners, int numSegments, List<org.infinispan.remoting.transport.Address> members, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.since 11.0. hashFunction is ignored, usecreate(int, int, List, Map)
instead.Create a new consistent hash instance. The consistent hash will be balanced.- Parameters:
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. Ifnull
, all the members are assumed to have a capacity factor of 1.
-
create
CH create(int numOwners, int numSegments, List<org.infinispan.remoting.transport.Address> members, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.Create a new consistent hash instance. The consistent hash will be balanced.- Parameters:
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. Ifnull
, all the members are assumed to have a capacity factor of 1.
-
updateMembers
CH updateMembers(CH baseCH, List<org.infinispan.remoting.transport.Address> newMembers, Map<org.infinispan.remoting.transport.Address,Float> capacityFactors)
Deprecated.Updates an existing consistent hash instance to remove owners that are not in thenewMembers
list.If a segment has at least one owner in
newMembers
, this method will not add another owner. This guarantees that the new consistent hash can be used immediately, without transferring any state.If a segment has no owners in
newMembers
and theConsistentHash
implementation (e.g.DefaultConsistentHash
) requires at least one owner for each segment, this method may add one or more owners for that segment. Since the data in that segment was lost, the new consistent hash can still be used without transferring state.- Parameters:
baseCH
- An existing consistent hash instance, should not benull
newMembers
- 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. Ifnull
, all the members are assumed to have a capacity factor of 1.- Returns:
- A new
ConsistentHash
instance, orbaseCH
if the existing instance does not need any changes.
-
rebalance
CH rebalance(CH baseCH)
Deprecated.Create a new consistent hash instance, based on an existing instance, but balanced according to the implementation's rules.- Parameters:
baseCH
- An existing consistent hash instance, should not benull
- Returns:
- A new
ConsistentHash
instance, orbaseCH
if the existing instance does not need any changes.
-
union
CH union(CH ch1, CH ch2)
Deprecated.Creates a union of two compatible ConsistentHashes (use the same hashing function and have the same configuration parameters).The owners of a segment
s
inunion(ch1, ch2)
will include both the owners ofs
inch1
and the owners ofs
inch2
, so a cache can switch from usingunion(ch1, ch2)
to usingch2
without transferring any state.
-
fromPersistentState
default CH fromPersistentState(ScopedPersistentState state)
Deprecated.Recreates a ConsistentHash from a previously stored persistent state. The returned ConsistentHash will not have proper addresses, butPersistentUUID
s instead so they will need to be replaced- Parameters:
state
- the state to restore
-
-