Package org.infinispan.distribution
Class LocalizedCacheTopology
java.lang.Object
org.infinispan.topology.CacheTopology
org.infinispan.distribution.LocalizedCacheTopology
Extends
CacheTopology with information about keys owned by the local node.- Since:
- 9.0
- Author:
- Dan Berindei
-
Nested Class Summary
Nested classes/interfaces inherited from class org.infinispan.topology.CacheTopology
CacheTopology.Externalizer, CacheTopology.Phase -
Constructor Summary
ConstructorsConstructorDescriptionLocalizedCacheTopology(CacheMode cacheMode, CacheTopology cacheTopology, KeyPartitioner keyPartitioner, Address localAddress, boolean connected) -
Method Summary
Modifier and TypeMethodDescriptiongetDistribution(Object key) getDistributionForSegment(int segmentId) Deprecated, for removal: This API element is subject to removal in a future version.intintintgetSegment(Object key) getSegmentDistribution(int segmentId) getWriteOwners(Object key) getWriteOwners(Collection<?> keys) booleanbooleanisReadOwner(Object key) booleanisSegmentReadOwner(int segment) booleanisSegmentWriteOwner(int segment) booleanisWriteOwner(Object key) static LocalizedCacheTopologymakeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments, Address localAddress) Creates a new local topology that has a single address but multiple segments.static LocalizedCacheTopologymakeSingletonTopology(CacheMode cacheMode, Address localAddress) Methods inherited from class org.infinispan.topology.CacheTopology
equals, getActualMembers, getCurrentCH, getMembers, getMembersPersistentUUIDs, getPendingCH, getPhase, getReadConsistentHash, getRebalanceId, getTopologyId, getUnionCH, getWriteConsistentHash, hashCode, logRoutingTableInformation, toString, wasTopologyRestoredFromState
-
Constructor Details
-
LocalizedCacheTopology
public LocalizedCacheTopology(CacheMode cacheMode, CacheTopology cacheTopology, KeyPartitioner keyPartitioner, Address localAddress, boolean connected)
-
-
Method Details
-
makeSingletonTopology
public static LocalizedCacheTopology makeSingletonTopology(CacheMode cacheMode, Address localAddress) - Parameters:
cacheMode- Ignored, the result topology is always LOCALlocalAddress- Address of the local node
-
makeSegmentedSingletonTopology
public static LocalizedCacheTopology makeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments, Address localAddress) Creates a new local topology that has a single address but multiple segments. This is useful when the data storage is segmented in some way (ie. segmented store)- Parameters:
keyPartitioner- partitioner to decide which segment a given key maps tonumSegments- how many segments there arelocalAddress- the address of this node- Returns:
- segmented topology
-
isReadOwner
- Returns:
trueiff keykeycan be read without going remote.
-
isSegmentReadOwner
public boolean isSegmentReadOwner(int segment) -
isWriteOwner
- Returns:
trueiff writing a value for keykeywill update it on the local node.
-
isSegmentWriteOwner
public boolean isSegmentWriteOwner(int segment) -
getSegment
- Returns:
- The consistent hash segment of key
key
-
getDistributionForSegment
Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 please usegetSegmentDistribution(int)instead.- Returns:
- Information about the ownership of segment
segment, including the primary owner.
-
getSegmentDistribution
-
getDistribution
- Returns:
- Information about the ownership of key
key, including the primary owner.
-
getWriteOwners
- Returns:
- An unordered collection with the write owners of
key.
-
getWriteOwners
- Returns:
- An unordered collection with the write owners of
keys.
-
getLocalReadSegments
- Returns:
- The segments owned by the local node for reading.
-
getLocalWriteSegments
- Returns:
- The segments owned by the local node for writing.
-
getLocalPrimarySegments
- Returns:
- The segments owned by the local node as primary owner.
-
getLocalWriteSegmentsCount
public int getLocalWriteSegmentsCount()- Returns:
- The number of segments owned by the local node for writing.
-
getLocalAddress
- Returns:
- The address of the local node.
-
getMembersSet
-
isConnected
public boolean isConnected()- Returns:
trueif the local node received this topology from the coordinator,falseotherwise (e.g. during preload).
-
getNumSegments
public int getNumSegments()
-
getSegmentDistribution(int)instead.