Package org.infinispan.distribution
Class LocalizedCacheTopology
- java.lang.Object
-
- org.infinispan.topology.CacheTopology
-
- org.infinispan.distribution.LocalizedCacheTopology
-
public class LocalizedCacheTopology extends org.infinispan.topology.CacheTopologyExtendsCacheTopologywith information about keys owned by the local node.- Since:
- 9.0
- Author:
- Dan Berindei
-
-
Constructor Summary
Constructors Constructor Description LocalizedCacheTopology(CacheMode cacheMode, org.infinispan.topology.CacheTopology cacheTopology, KeyPartitioner keyPartitioner, org.infinispan.remoting.transport.Address localAddress, boolean connected)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DistributionInfogetDistribution(Object key)DistributionInfogetDistributionForSegment(int segmentId)Deprecated.since 9.3 please usegetSegmentDistribution(int)instead.org.infinispan.remoting.transport.AddressgetLocalAddress()IntSetgetLocalReadSegments()Set<org.infinispan.remoting.transport.Address>getMembersSet()intgetSegment(Object key)DistributionInfogetSegmentDistribution(int segmentId)Collection<org.infinispan.remoting.transport.Address>getWriteOwners(Object key)Collection<org.infinispan.remoting.transport.Address>getWriteOwners(Collection<?> keys)booleanisConnected()booleanisReadOwner(Object key)booleanisSegmentReadOwner(int segment)booleanisSegmentWriteOwner(int segment)booleanisWriteOwner(Object key)static LocalizedCacheTopologymakeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments, org.infinispan.remoting.transport.Address localAddress)Creates a new local topology that has a single address but multiple segments.static LocalizedCacheTopologymakeSingletonTopology(CacheMode cacheMode, org.infinispan.remoting.transport.Address localAddress)
-
-
-
Constructor Detail
-
LocalizedCacheTopology
public LocalizedCacheTopology(CacheMode cacheMode, org.infinispan.topology.CacheTopology cacheTopology, KeyPartitioner keyPartitioner, org.infinispan.remoting.transport.Address localAddress, boolean connected)
-
-
Method Detail
-
makeSingletonTopology
public static LocalizedCacheTopology makeSingletonTopology(CacheMode cacheMode, org.infinispan.remoting.transport.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, org.infinispan.remoting.transport.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:
trueiff keykeycan be read without going remote.
-
isSegmentReadOwner
public boolean isSegmentReadOwner(int segment)
-
isWriteOwner
public boolean isWriteOwner(Object key)
- Returns:
trueiff writing a value for keykeywill 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<org.infinispan.remoting.transport.Address> getWriteOwners(Object key)
- Returns:
- An unordered collection with the write owners of
key.
-
getWriteOwners
public Collection<org.infinispan.remoting.transport.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 org.infinispan.remoting.transport.Address getLocalAddress()
- Returns:
- The address of the local node.
-
getMembersSet
public Set<org.infinispan.remoting.transport.Address> getMembersSet()
-
isConnected
public boolean isConnected()
- Returns:
trueif the local node received this topology from the coordinator,falseotherwise (e.g. during preload).
-
-