Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reserve all methods with 'master' in the names in the package 'org.opensearch.action.support.clustermanager' #3644

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ public final RequestBuilder setClusterManagerNodeTimeout(TimeValue timeout) {
return (RequestBuilder) this;
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)}
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
return setClusterManagerNodeTimeout(timeout);
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
Expand All @@ -72,4 +83,14 @@ public final RequestBuilder setClusterManagerNodeTimeout(String timeout) {
return (RequestBuilder) this;
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)}
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(String timeout) {
return setClusterManagerNodeTimeout(timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ public abstract class ClusterManagerNodeRequest<Request extends ClusterManagerNo

public static final TimeValue DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);

/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT} */
@Deprecated
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;

protected TimeValue clusterManagerNodeTimeout = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;

/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout} */
@Deprecated
protected TimeValue masterNodeTimeout = clusterManagerNodeTimeout;

protected ClusterManagerNodeRequest() {}

protected ClusterManagerNodeRequest(StreamInput in) throws IOException {
Expand All @@ -72,6 +80,17 @@ public final Request clusterManagerNodeTimeout(TimeValue timeout) {
return (Request) this;
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout(TimeValue)}
*/
@SuppressWarnings("unchecked")
@Deprecated
public final Request masterNodeTimeout(TimeValue timeout) {
return clusterManagerNodeTimeout(timeout);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
Expand All @@ -81,11 +100,20 @@ public final Request clusterManagerNodeTimeout(String timeout) {
);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout(String)}
*/
@Deprecated
public final Request masterNodeTimeout(String timeout) {
return clusterManagerNodeTimeout(timeout);
}

public final TimeValue clusterManagerNodeTimeout() {
return this.clusterManagerNodeTimeout;
}

// Preserve the method so that classes implements AcknowledgedRequest don't need to override it for backwards compatibility.
/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout()} */
@Deprecated
public final TimeValue masterNodeTimeout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ protected TransportClusterManagerNodeAction(
protected abstract void clusterManagerOperation(Request request, ClusterState state, ActionListener<Response> listener)
throws Exception;

// Preserve the method so that o.o.action.support.master.info.TransportClusterInfoAction class
// can override masterOperation() for backwards compatibility.
// Change the method to be concrete after deprecation so that existing class can override it while new class don't have to.
/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterManagerNodeRequest, ClusterState, ActionListener)} */
@Deprecated
protected void masterOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
Expand All @@ -136,6 +135,16 @@ protected void clusterManagerOperation(Task task, Request request, ClusterState
clusterManagerOperation(request, state, listener);
}

/**
* Override this operation if access to the task parameter is needed
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerOperation(Task, ClusterManagerNodeRequest, ClusterState, ActionListener)}
*/
@Deprecated
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
clusterManagerOperation(task, request, state, listener);
}

protected boolean localExecute(Request request) {
return false;
}
Expand Down Expand Up @@ -303,4 +312,15 @@ public void onTimeout(TimeValue timeout) {
protected String getClusterManagerActionName(DiscoveryNode node) {
return actionName;
}

/**
* Allows to conditionally return a different cluster-manager node action name in the case an action gets renamed.
* This mainly for backwards compatibility should be used rarely
*
* @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #getClusterManagerActionName(DiscoveryNode)}
*/
@Deprecated
protected String getMasterActionName(DiscoveryNode node) {
return getClusterManagerActionName(node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,24 @@ protected final void clusterManagerOperation(final Request request, final Cluste
doClusterManagerOperation(request, concreteIndices, state, listener);
}

/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerOperation(ClusterInfoRequest, ClusterState, ActionListener)} */
@Deprecated
@Override
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
clusterManagerOperation(request, state, listener);
}

protected abstract void doClusterManagerOperation(
Request request,
String[] concreteIndices,
ClusterState state,
ActionListener<Response> listener
);

// Change the method to be concrete after deprecation so that existing class can override it while new class don't have to.
/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #doClusterManagerOperation(ClusterInfoRequest, String[], ClusterState, ActionListener)} */
@Deprecated
protected void doMasterOperation(Request request, String[] concreteIndices, ClusterState state, ActionListener<Response> listener) {
doClusterManagerOperation(request, concreteIndices, state, listener);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.opensearch.action.support.clustermanager.ClusterManagerNodeOperationRequestBuilder;
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.client.OpenSearchClient;
import org.opensearch.common.unit.TimeValue;

/**
* Base request builder for cluster-manager node operations
Expand All @@ -55,22 +54,4 @@ public abstract class MasterNodeOperationRequestBuilder<
protected MasterNodeOperationRequestBuilder(OpenSearchClient client, ActionType<Response> action, Request request) {
super(client, action, request);
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(TimeValue timeout) {
return setClusterManagerNodeTimeout(timeout);
}

/**
* Sets the cluster-manager node timeout in case the cluster-manager has not yet been discovered.
*/
@SuppressWarnings("unchecked")
@Deprecated
public final RequestBuilder setMasterNodeTimeout(String timeout) {
return setClusterManagerNodeTimeout(timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.unit.TimeValue;

import java.io.IOException;

Expand All @@ -47,30 +46,7 @@
@Deprecated
public abstract class MasterNodeRequest<Request extends MasterNodeRequest<Request>> extends ClusterManagerNodeRequest<Request> {

@Deprecated
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;

@Deprecated
protected TimeValue masterNodeTimeout = clusterManagerNodeTimeout;

protected MasterNodeRequest(StreamInput in) throws IOException {
super(in);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
@SuppressWarnings("unchecked")
@Deprecated
public final Request masterNodeTimeout(TimeValue timeout) {
return clusterManagerNodeTimeout(timeout);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
@Deprecated
public final Request masterNodeTimeout(String timeout) {
return clusterManagerNodeTimeout(timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.stream.Writeable;
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;

Expand Down Expand Up @@ -93,20 +91,4 @@ protected TransportMasterNodeAction(
@Deprecated
protected abstract void masterOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception;

/**
* Override this operation if access to the task parameter is needed
*/
@Deprecated
protected void masterOperation(Task task, Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
clusterManagerOperation(task, request, state, listener);
}

/**
* Allows to conditionally return a different cluster-manager node action name in the case an action gets renamed.
* This mainly for backwards compatibility should be used rarely
*/
@Deprecated
protected String getMasterActionName(DiscoveryNode node) {
return getClusterManagerActionName(node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public TransportClusterInfoAction(
super(actionName, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver);
}

@Deprecated
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) {
clusterManagerOperation(request, state, listener);
}

@Deprecated
protected abstract void doMasterOperation(
Request request,
Expand Down