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
ExtendsCacheTopology
with 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 DistributionInfo
getDistribution(Object key)
DistributionInfo
getDistributionForSegment(int segmentId)
Deprecated.since 9.3 please usegetSegmentDistribution(int)
instead.org.infinispan.remoting.transport.Address
getLocalAddress()
IntSet
getLocalPrimarySegments()
IntSet
getLocalReadSegments()
IntSet
getLocalWriteSegments()
int
getLocalWriteSegmentsCount()
Set<org.infinispan.remoting.transport.Address>
getMembersSet()
int
getNumSegments()
int
getSegment(Object key)
DistributionInfo
getSegmentDistribution(int segmentId)
Collection<org.infinispan.remoting.transport.Address>
getWriteOwners(Object key)
Collection<org.infinispan.remoting.transport.Address>
getWriteOwners(Collection<?> keys)
boolean
isConnected()
boolean
isReadOwner(Object key)
boolean
isSegmentReadOwner(int segment)
boolean
isSegmentWriteOwner(int segment)
boolean
isWriteOwner(Object key)
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.static LocalizedCacheTopology
makeSingletonTopology(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:
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<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.
-
getLocalWriteSegments
public IntSet getLocalWriteSegments()
- Returns:
- The segments owned by the local node for writing.
-
getLocalPrimarySegments
public IntSet 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
public Set<org.infinispan.remoting.transport.Address> getMembersSet()
-
isConnected
public boolean isConnected()
- Returns:
true
if the local node received this topology from the coordinator,false
otherwise (e.g. during preload).
-
getNumSegments
public int getNumSegments()
-
-