Package org.infinispan.distribution
Class LocalizedCacheTopology
java.lang.Object
org.infinispan.topology.CacheTopology
org.infinispan.distribution.LocalizedCacheTopology
public class LocalizedCacheTopology
extends org.infinispan.topology.CacheTopology
Extends
CacheTopology with information about keys owned by the local node.- Since:
- 9.0
- Author:
- Dan Berindei
-
Constructor Summary
ConstructorsConstructorDescriptionLocalizedCacheTopology(CacheMode cacheMode, org.infinispan.topology.CacheTopology cacheTopology, KeyPartitioner keyPartitioner, org.infinispan.remoting.transport.Address localAddress, boolean connected) -
Method Summary
Modifier and TypeMethodDescriptiongetDistribution(Object key) getDistributionForSegment(int segmentId) Deprecated.org.infinispan.remoting.transport.AddressintSet<org.infinispan.remoting.transport.Address>intintgetSegment(Object key) getSegmentDistribution(int segmentId) Collection<org.infinispan.remoting.transport.Address>getWriteOwners(Object key) Collection<org.infinispan.remoting.transport.Address>getWriteOwners(Collection<?> keys) booleanbooleanisReadOwner(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 Details
-
LocalizedCacheTopology
public LocalizedCacheTopology(CacheMode cacheMode, org.infinispan.topology.CacheTopology cacheTopology, KeyPartitioner keyPartitioner, org.infinispan.remoting.transport.Address localAddress, boolean connected)
-
-
Method Details
-
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
- 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.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
public org.infinispan.remoting.transport.Address 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.