Class RemoteClusterAware

java.lang.Object
org.elasticsearch.transport.RemoteClusterAware
Direct Known Subclasses:
RemoteClusterService

public abstract class RemoteClusterAware
extends java.lang.Object
Base class for all services and components that need up-to-date information about the registered remote clusters
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String LOCAL_CLUSTER_GROUP_KEY  
    static char REMOTE_CLUSTER_INDEX_SEPARATOR  
    protected Settings settings  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected RemoteClusterAware​(Settings settings)
    Creates a new RemoteClusterAware instance
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String buildRemoteIndexName​(java.lang.String clusterAlias, java.lang.String indexName)  
    protected static java.util.Set<java.lang.String> getEnabledRemoteClusters​(Settings settings)
    Returns remote clusters that are enabled in these settings
    protected java.util.Map<java.lang.String,​java.util.List<java.lang.String>> groupClusterIndices​(java.util.Set<java.lang.String> remoteClusterNames, java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
    Groups indices per cluster by splitting remote cluster-alias, index-name pairs on REMOTE_CLUSTER_INDEX_SEPARATOR.
    void listenForUpdates​(ClusterSettings clusterSettings)
    Registers this instance to listen to updates on the cluster settings.
    protected abstract void updateRemoteCluster​(java.lang.String clusterAlias, Settings settings)
    Subclasses must implement this to receive information about updated cluster aliases.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • REMOTE_CLUSTER_INDEX_SEPARATOR

      public static final char REMOTE_CLUSTER_INDEX_SEPARATOR
      See Also:
      Constant Field Values
    • LOCAL_CLUSTER_GROUP_KEY

      public static final java.lang.String LOCAL_CLUSTER_GROUP_KEY
      See Also:
      Constant Field Values
    • settings

      protected final Settings settings
  • Constructor Details

    • RemoteClusterAware

      protected RemoteClusterAware​(Settings settings)
      Creates a new RemoteClusterAware instance
      Parameters:
      settings - the nodes level settings
  • Method Details

    • getEnabledRemoteClusters

      protected static java.util.Set<java.lang.String> getEnabledRemoteClusters​(Settings settings)
      Returns remote clusters that are enabled in these settings
    • groupClusterIndices

      protected java.util.Map<java.lang.String,​java.util.List<java.lang.String>> groupClusterIndices​(java.util.Set<java.lang.String> remoteClusterNames, java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
      Groups indices per cluster by splitting remote cluster-alias, index-name pairs on REMOTE_CLUSTER_INDEX_SEPARATOR. All indices per cluster are collected as a list in the returned map keyed by the cluster alias. Local indices are grouped under LOCAL_CLUSTER_GROUP_KEY. The returned map is mutable.
      Parameters:
      remoteClusterNames - the remote cluster names
      requestIndices - the indices in the search request to filter
      indexExists - a predicate that can test if a certain index or alias exists in the local cluster
      Returns:
      a map of grouped remote and local indices
    • updateRemoteCluster

      protected abstract void updateRemoteCluster​(java.lang.String clusterAlias, Settings settings)
      Subclasses must implement this to receive information about updated cluster aliases.
    • listenForUpdates

      public void listenForUpdates​(ClusterSettings clusterSettings)
      Registers this instance to listen to updates on the cluster settings.
    • buildRemoteIndexName

      public static java.lang.String buildRemoteIndexName​(java.lang.String clusterAlias, java.lang.String indexName)