Class 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 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 LOCAL
        localAddress - 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 to
        numSegments - how many segments there are
        localAddress - the address of this node
        Returns:
        segmented topology
      • isReadOwner

        public boolean isReadOwner​(Object key)
        Returns:
        true iff key key 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 key key 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 use getSegmentDistribution(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()