Package org.infinispan.topology
Class CacheTopology
- java.lang.Object
-
- org.infinispan.topology.CacheTopology
-
- Direct Known Subclasses:
LocalizedCacheTopology
public class CacheTopology extends java.lang.Object
The status of a cache from a distribution/state transfer point of view. The pending CH can benull
if we don't have a state transfer in progress. ThetopologyId
is incremented every time the topology changes (e.g. a member leaves, state transfer starts or ends). TherebalanceId
is not modified when the consistent hashes are updated without requiring state transfer (e.g. when a member leaves).- Since:
- 5.2
- Author:
- Dan Berindei
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheTopology.Externalizer
static class
CacheTopology.Phase
Phase of the rebalance process.
-
Constructor Summary
Constructors Constructor Description CacheTopology(int topologyId, int rebalanceId, ConsistentHash currentCH, ConsistentHash pendingCH, ConsistentHash unionCH, CacheTopology.Phase phase, java.util.List<Address> actualMembers, java.util.List<PersistentUUID> persistentUUIDs)
CacheTopology(int topologyId, int rebalanceId, ConsistentHash currentCH, ConsistentHash pendingCH, CacheTopology.Phase phase, java.util.List<Address> actualMembers, java.util.List<PersistentUUID> persistentUUIDs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.util.List<Address>
getActualMembers()
ConsistentHash
getCurrentCH()
The current consistent hash.java.util.List<Address>
getMembers()
java.util.List<PersistentUUID>
getMembersPersistentUUIDs()
ConsistentHash
getPendingCH()
The future consistent hash.CacheTopology.Phase
getPhase()
ConsistentHash
getReadConsistentHash()
Read operations should always go to the "current" owners.int
getRebalanceId()
The id of the latest started rebalance.int
getTopologyId()
ConsistentHash
getUnionCH()
The union of the current and future consistent hashes.ConsistentHash
getWriteConsistentHash()
When there is a rebalance in progress, write operations should go to the union of the "current" and "future" owners.int
hashCode()
void
logRoutingTableInformation()
java.lang.String
toString()
-
-
-
Constructor Detail
-
CacheTopology
public CacheTopology(int topologyId, int rebalanceId, ConsistentHash currentCH, ConsistentHash pendingCH, CacheTopology.Phase phase, java.util.List<Address> actualMembers, java.util.List<PersistentUUID> persistentUUIDs)
-
CacheTopology
public CacheTopology(int topologyId, int rebalanceId, ConsistentHash currentCH, ConsistentHash pendingCH, ConsistentHash unionCH, CacheTopology.Phase phase, java.util.List<Address> actualMembers, java.util.List<PersistentUUID> persistentUUIDs)
-
-
Method Detail
-
getTopologyId
public int getTopologyId()
-
getCurrentCH
public ConsistentHash getCurrentCH()
The current consistent hash.
-
getPendingCH
public ConsistentHash getPendingCH()
The future consistent hash. Should benull
if there is no rebalance in progress.
-
getUnionCH
public ConsistentHash getUnionCH()
The union of the current and future consistent hashes. Should benull
if there is no rebalance in progress.
-
getRebalanceId
public int getRebalanceId()
The id of the latest started rebalance.
-
getMembers
public java.util.List<Address> getMembers()
- Returns:
- The nodes that are members in both consistent hashes (if
pendingCH != null
, otherwise the members of the current CH). - See Also:
getActualMembers()
-
getActualMembers
public java.util.List<Address> getActualMembers()
- Returns:
- The nodes that are active members of the cache. It should be equal to
getMembers()
when the cache is available, and a strict subset if the cache is in degraded mode. - See Also:
AvailabilityMode
-
getMembersPersistentUUIDs
public java.util.List<PersistentUUID> getMembersPersistentUUIDs()
-
getReadConsistentHash
public ConsistentHash getReadConsistentHash()
Read operations should always go to the "current" owners.
-
getWriteConsistentHash
public ConsistentHash getWriteConsistentHash()
When there is a rebalance in progress, write operations should go to the union of the "current" and "future" owners.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
logRoutingTableInformation
public final void logRoutingTableInformation()
-
getPhase
public CacheTopology.Phase getPhase()
-
-