Package org.elasticsearch.transport
Class RemoteClusterAware
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.transport.RemoteClusterAware
-
- Direct Known Subclasses:
RemoteClusterService
public abstract class RemoteClusterAware extends AbstractComponent
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 protected ClusterNameExpressionResolver
clusterNameResolver
static java.lang.String
LOCAL_CLUSTER_GROUP_KEY
static char
REMOTE_CLUSTER_INDEX_SEPARATOR
static Setting.AffixSetting<java.util.List<java.net.InetSocketAddress>>
REMOTE_CLUSTERS_SEEDS
A list of initial seed nodes to discover eligible nodes from the remote cluster-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
deprecationLogger, logger, settings
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteClusterAware(Settings settings)
Creates a newRemoteClusterAware
instance
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static java.util.Map<java.lang.String,java.util.List<DiscoveryNode>>
buildRemoteClustersSeeds(Settings settings)
static java.lang.String
buildRemoteIndexName(java.lang.String clusterAlias, java.lang.String indexName)
protected abstract java.util.Set<java.lang.String>
getRemoteClusterNames()
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
groupClusterIndices(java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
Groups indices per cluster by splitting remote cluster-alias, index-name pairs onREMOTE_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, java.util.List<java.net.InetSocketAddress> addresses)
Subclasses must implement this to receive information about updated cluster aliases.-
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
logDeprecatedSetting, logRemovedSetting, nodeName
-
-
-
-
Field Detail
-
REMOTE_CLUSTERS_SEEDS
public static final Setting.AffixSetting<java.util.List<java.net.InetSocketAddress>> REMOTE_CLUSTERS_SEEDS
A list of initial seed nodes to discover eligible nodes from the remote cluster
-
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
-
clusterNameResolver
protected final ClusterNameExpressionResolver clusterNameResolver
-
-
Constructor Detail
-
RemoteClusterAware
protected RemoteClusterAware(Settings settings)
Creates a newRemoteClusterAware
instance- Parameters:
settings
- the nodes level settings
-
-
Method Detail
-
buildRemoteClustersSeeds
protected static java.util.Map<java.lang.String,java.util.List<DiscoveryNode>> buildRemoteClustersSeeds(Settings settings)
-
groupClusterIndices
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> groupClusterIndices(java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
Groups indices per cluster by splitting remote cluster-alias, index-name pairs onREMOTE_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 underLOCAL_CLUSTER_GROUP_KEY
. The returned map is mutable.- Parameters:
requestIndices
- the indices in the search request to filterindexExists
- 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
-
getRemoteClusterNames
protected abstract java.util.Set<java.lang.String> getRemoteClusterNames()
-
updateRemoteCluster
protected abstract void updateRemoteCluster(java.lang.String clusterAlias, java.util.List<java.net.InetSocketAddress> addresses)
Subclasses must implement this to receive information about updated cluster aliases. If the given address list is empty the cluster alias is unregistered and should be removed.
-
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)
-
-