Class ShardCoreKeyMap


  • public final class ShardCoreKeyMap
    extends java.lang.Object
    A map between segment core cache keys and the shard that these segments belong to. This allows to get the shard that a segment belongs to or to get the entire set of live core cache keys for a given index. In order to work this class needs to be notified about new segments. It modifies the current mappings as segments that were not known before are added and prevents the structure from growing indefinitely by registering close listeners on these segments so that at any time it only tracks live segments. NOTE: This is heavy. Avoid using this class unless absolutely required.
    • Constructor Summary

      Constructors 
      Constructor Description
      ShardCoreKeyMap()  
    • Method Summary

      Modifier and Type Method Description
      void add​(org.apache.lucene.index.LeafReader reader)
      Register a LeafReader.
      java.util.Set<java.lang.Object> getCoreKeysForIndex​(java.lang.String index)
      Get the set of core cache keys associated with the given index.
      ShardId getShardId​(java.lang.Object coreKey)
      Return the ShardId that holds the given segment, or null if this segment is not tracked.
      int size()
      Return the number of tracked segments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShardCoreKeyMap

        public ShardCoreKeyMap()
    • Method Detail

      • add

        public void add​(org.apache.lucene.index.LeafReader reader)
        Register a LeafReader. This is necessary so that the core cache key of this reader can be found later using getCoreKeysForIndex(String).
      • getShardId

        public ShardId getShardId​(java.lang.Object coreKey)
        Return the ShardId that holds the given segment, or null if this segment is not tracked.
      • getCoreKeysForIndex

        public java.util.Set<java.lang.Object> getCoreKeysForIndex​(java.lang.String index)
        Get the set of core cache keys associated with the given index.
      • size

        public int size()
        Return the number of tracked segments.