Package org.infinispan.topology
Interface LocalTopologyManager
- All Known Implementing Classes:
LocalTopologyManagerImpl
public interface LocalTopologyManager
Runs on every node and handles the communication with the
ClusterTopologyManager
.- Since:
- 5.2
- Author:
- Dan Berindei
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
assertTopologyStable
(String cacheName) Asserts the cache with the given name has a stable topology installed.void
cacheShutdown
(String name) Initiates a cluster-wide cache shutdown for the specified cachevoid
confirmRebalancePhase
(String cacheName, int topologyId, int rebalanceId, Throwable throwable) Confirm that the local cachecacheName
has finished receiving the new data for topologytopologyId
.getCacheAvailability
(String cacheName) Retrieves the availability state of a cache.getCacheTopology
(String cacheName) Returns the local UUID of this node.getRebalancingStatus
(String cacheName) Retrieve the rebalancing status for the specified cachegetStableCacheTopology
(String cacheName) handleCacheShutdown
(String cacheName) Handles the local operations related to gracefully shutting down a cachehandleRebalance
(String cacheName, CacheTopology cacheTopology, int viewId, Address sender) Performs the state transfer.handleStableTopologyUpdate
(String cacheName, CacheTopology cacheTopology, Address sender, int viewId) Update the stable cache topology.handleStatusRequest
(int viewId) Recovers the current topology information for all running caches and returns it to the coordinator.handleTopologyUpdate
(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender) Updates the current and/or pending consistent hash, without transferring any state.boolean
isCacheRebalancingEnabled
(String cacheName) Checks whether rebalancing is enabled for the specified cache.boolean
Checks whether rebalancing is enabled for the entire cluster.join
(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm) Forwards the join request to the coordinator.void
Forwards the leave request to the coordinator.void
setCacheAvailability
(String cacheName, AvailabilityMode availabilityMode) Updates the availability state of a cache (for the entire cluster).void
setCacheRebalancingEnabled
(String cacheName, boolean enabled) Enable or disable rebalancing for the specified cache.void
setRebalancingEnabled
(boolean enabled) Enable or disable rebalancing in the entire cluster.stableTopologyCompletion
(String cacheName) Returns aCompletionStage
that completes when the cache with the namecacheName
has a stable topology.
-
Method Details
-
join
CompletionStage<CacheTopology> join(String cacheName, CacheJoinInfo joinInfo, CacheTopologyHandler stm, PartitionHandlingManager phm) throws Exception Forwards the join request to the coordinator.- Returns:
- The current consistent hash.
- Throws:
Exception
-
leave
Forwards the leave request to the coordinator. -
confirmRebalancePhase
Confirm that the local cachecacheName
has finished receiving the new data for topologytopologyId
.The coordinator can change during the state transfer, so we make the rebalance RPC async and we send the response as a different command.
- Parameters:
cacheName
- the name of the cachetopologyId
- the current topology id of the node at the time the rebalance is completed.rebalanceId
- the id of the current rebalancethrowable
-null
unless local rebalance ended because of an error.
-
handleStatusRequest
Recovers the current topology information for all running caches and returns it to the coordinator.- Parameters:
viewId
- The coordinator's view id
-
handleTopologyUpdate
CompletionStage<Void> handleTopologyUpdate(String cacheName, CacheTopology cacheTopology, AvailabilityMode availabilityMode, int viewId, Address sender) Updates the current and/or pending consistent hash, without transferring any state. -
handleStableTopologyUpdate
CompletionStage<Void> handleStableTopologyUpdate(String cacheName, CacheTopology cacheTopology, Address sender, int viewId) Update the stable cache topology.Mostly needed for backup, so that a new coordinator can recover the stable topology of the cluster.
-
handleRebalance
CompletionStage<Void> handleRebalance(String cacheName, CacheTopology cacheTopology, int viewId, Address sender) Performs the state transfer. -
getCacheTopology
- Returns:
- the current topology for a cache.
-
getStableCacheTopology
- Returns:
- the last stable topology for a cache.
-
isRebalancingEnabled
Checks whether rebalancing is enabled for the entire cluster.- Throws:
Exception
-
isCacheRebalancingEnabled
Checks whether rebalancing is enabled for the specified cache.- Throws:
Exception
-
setRebalancingEnabled
Enable or disable rebalancing in the entire cluster.- Throws:
Exception
-
setCacheRebalancingEnabled
Enable or disable rebalancing for the specified cache.- Throws:
Exception
-
getRebalancingStatus
Retrieve the rebalancing status for the specified cache- Throws:
Exception
-
getCacheAvailability
Retrieves the availability state of a cache. -
setCacheAvailability
Updates the availability state of a cache (for the entire cluster).- Throws:
Exception
-
getPersistentUUID
PersistentUUID getPersistentUUID()Returns the local UUID of this node. If global state persistence is enabled, this UUID will be saved and reused across restarts -
cacheShutdown
Initiates a cluster-wide cache shutdown for the specified cache -
handleCacheShutdown
Handles the local operations related to gracefully shutting down a cache -
stableTopologyCompletion
Returns aCompletionStage
that completes when the cache with the namecacheName
has a stable topology. Returns null if the cache does not exist. -
assertTopologyStable
Asserts the cache with the given name has a stable topology installed.- Parameters:
cacheName
- : The cache name to search.
-