Package org.infinispan.distribution
Class LocalizedCacheTopology
- java.lang.Object
-
- org.infinispan.topology.CacheTopology
-
- org.infinispan.distribution.LocalizedCacheTopology
-
public class LocalizedCacheTopology extends CacheTopology
ExtendsCacheTopology
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
Constructors Constructor Description LocalizedCacheTopology(CacheMode cacheMode, CacheTopology cacheTopology, KeyPartitioner keyPartitioner, Address localAddress, boolean connected)
-
Method Summary
-
Methods inherited from class org.infinispan.topology.CacheTopology
equals, getActualMembers, getCurrentCH, getMembers, getMembersPersistentUUIDs, getPendingCH, getPhase, getReadConsistentHash, getRebalanceId, getTopologyId, getUnionCH, getWriteConsistentHash, hashCode, logRoutingTableInformation, toString
-
-
-
-
Constructor Detail
-
LocalizedCacheTopology
public LocalizedCacheTopology(CacheMode cacheMode, CacheTopology cacheTopology, KeyPartitioner keyPartitioner, Address localAddress, boolean connected)
-
-
Method Detail
-
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
public boolean isReadOwner(Object key)
- Returns:
true
iff keykey
can be read without going remote.
-
isSegmentReadOwner
public boolean isSegmentReadOwner(int segment)
-
isWriteOwner
public boolean isWriteOwner(Object key)
- Returns:
true
iff writing a value for keykey
will update it on the local node.
-
isSegmentWriteOwner
public boolean isSegmentWriteOwner(int segment)
-
getSegment
public int getSegment(Object key)
- Returns:
- The consistent hash segment of key
key
-
getDistributionForSegment
@Deprecated public DistributionInfo getDistributionForSegment(int segmentId)
Deprecated.since 9.3 please usegetSegmentDistribution(int)
instead.- Returns:
- Information about the ownership of segment
segment
, including the primary owner.
-
getSegmentDistribution
public DistributionInfo getSegmentDistribution(int segmentId)
-
getDistribution
public DistributionInfo getDistribution(Object key)
- Returns:
- Information about the ownership of key
key
, including the primary owner.
-
getWriteOwners
public Collection<Address> getWriteOwners(Object key)
- Returns:
- An unordered collection with the write owners of
key
.
-
getWriteOwners
public Collection<Address> getWriteOwners(Collection<?> keys)
- Returns:
- An unordered collection with the write owners of
keys
.
-
getLocalReadSegments
public IntSet getLocalReadSegments()
- Returns:
- The segments owned by the local node for reading.
-
getLocalAddress
public Address getLocalAddress()
- Returns:
- The address of the local node.
-
isConnected
public boolean isConnected()
- Returns:
true
if the local node received this topology from the coordinator,false
otherwise (e.g. during preload).
-
-