Skip to content

Commit

Permalink
Deprecate public methods and variables that contain 'master' terminol…
Browse files Browse the repository at this point in the history
…ogy in 'client' directory (#3966)

* Deprecate public methods and variables that contain 'master' terminology in 'client' directory

Signed-off-by: Tianli Feng <[email protected]>

* Change 3 String type usages with 'master' to 'cluster manager'

Signed-off-by: Tianli Feng <[email protected]>
  • Loading branch information
Tianli Feng authored Jul 22, 2022
1 parent b08a2b8 commit ccf1d15
Show file tree
Hide file tree
Showing 15 changed files with 175 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static Request putComponentTemplate(PutComponentTemplateRequest putComponentTemp
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(putComponentTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putComponentTemplateRequest.clusterManagerNodeTimeout());
if (putComponentTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
Expand All @@ -124,7 +124,7 @@ static Request getComponentTemplates(GetComponentTemplatesRequest getComponentTe
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getComponentTemplatesRequest.isLocal());
params.withClusterManagerTimeout(getComponentTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getComponentTemplatesRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -136,7 +136,7 @@ static Request componentTemplatesExist(ComponentTemplatesExistRequest componentT
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(componentTemplatesRequest.isLocal());
params.withClusterManagerTimeout(componentTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(componentTemplatesRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -146,7 +146,7 @@ static Request deleteComponentTemplate(DeleteComponentTemplateRequest deleteComp
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(deleteComponentTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteComponentTemplateRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static Request closeIndex(CloseIndexRequest closeIndexRequest) {

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(closeIndexRequest.timeout());
parameters.withClusterManagerTimeout(closeIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(closeIndexRequest.clusterManagerNodeTimeout());
parameters.withIndicesOptions(closeIndexRequest.indicesOptions());
request.addParameters(parameters.asMap());
return request;
Expand All @@ -156,7 +156,7 @@ static Request createIndex(CreateIndexRequest createIndexRequest) throws IOExcep

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(createIndexRequest.timeout());
parameters.withClusterManagerTimeout(createIndexRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(createIndexRequest.clusterManagerNodeTimeout());
parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(createIndexRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand All @@ -179,7 +179,7 @@ static Request putMapping(PutMappingRequest putMappingRequest) throws IOExceptio

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putMappingRequest.timeout());
parameters.withClusterManagerTimeout(putMappingRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(putMappingRequest.clusterManagerNodeTimeout());
parameters.withIndicesOptions(putMappingRequest.indicesOptions());
request.addParameters(parameters.asMap());
request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand All @@ -192,7 +192,7 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) {
Request request = new Request(HttpGet.METHOD_NAME, RequestConverters.endpoint(indices, "_mapping"));

RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withClusterManagerTimeout(getMappingsRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(getMappingsRequest.clusterManagerNodeTimeout());
parameters.withIndicesOptions(getMappingsRequest.indicesOptions());
parameters.withLocal(getMappingsRequest.local());
request.addParameters(parameters.asMap());
Expand Down Expand Up @@ -332,7 +332,7 @@ private static Request resize(ResizeRequest resizeRequest, ResizeType type) thro

RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(resizeRequest.timeout());
params.withClusterManagerTimeout(resizeRequest.masterNodeTimeout());
params.withClusterManagerTimeout(resizeRequest.clusterManagerNodeTimeout());
params.withWaitForActiveShards(resizeRequest.getWaitForActiveShards());
request.addParameters(params.asMap());
request.setEntity(RequestConverters.createEntity(resizeRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
Expand Down Expand Up @@ -365,7 +365,7 @@ static Request rollover(RolloverRequest rolloverRequest) throws IOException {

RequestConverters.Params params = new RequestConverters.Params();
params.withTimeout(rolloverRequest.timeout());
params.withClusterManagerTimeout(rolloverRequest.masterNodeTimeout());
params.withClusterManagerTimeout(rolloverRequest.clusterManagerNodeTimeout());
params.withWaitForActiveShards(rolloverRequest.getCreateIndexRequest().waitForActiveShards());
if (rolloverRequest.isDryRun()) {
params.putParam("dry_run", Boolean.TRUE.toString());
Expand Down Expand Up @@ -402,7 +402,7 @@ static Request getIndex(GetIndexRequest getIndexRequest) {
params.withLocal(getIndexRequest.local());
params.withIncludeDefaults(getIndexRequest.includeDefaults());
params.withHuman(getIndexRequest.humanReadable());
params.withClusterManagerTimeout(getIndexRequest.masterNodeTimeout());
params.withClusterManagerTimeout(getIndexRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down Expand Up @@ -461,7 +461,7 @@ static Request putIndexTemplate(PutComposableIndexTemplateRequest putIndexTempla
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(putIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(putIndexTemplateRequest.clusterManagerNodeTimeout());
if (putIndexTemplateRequest.create()) {
params.putParam("create", Boolean.TRUE.toString());
}
Expand All @@ -479,7 +479,7 @@ static Request simulateIndexTemplate(SimulateIndexTemplateRequest simulateIndexT
.build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(simulateIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(simulateIndexTemplateRequest.clusterManagerNodeTimeout());
PutComposableIndexTemplateRequest putComposableIndexTemplateRequest = simulateIndexTemplateRequest.indexTemplateV2Request();
if (putComposableIndexTemplateRequest != null) {
if (putComposableIndexTemplateRequest.create()) {
Expand Down Expand Up @@ -529,7 +529,7 @@ static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest) {
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getIndexTemplatesRequest.isLocal());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -541,7 +541,7 @@ static Request getIndexTemplates(GetComposableIndexTemplateRequest getIndexTempl
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(getIndexTemplatesRequest.isLocal());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(getIndexTemplatesRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -553,7 +553,7 @@ static Request templatesExist(IndexTemplatesExistRequest indexTemplatesExistRequ
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(indexTemplatesExistRequest.isLocal());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -565,7 +565,7 @@ static Request templatesExist(ComposableIndexTemplateExistRequest indexTemplates
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
final RequestConverters.Params params = new RequestConverters.Params();
params.withLocal(indexTemplatesExistRequest.isLocal());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getMasterNodeTimeout());
params.withClusterManagerTimeout(indexTemplatesExistRequest.getClusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand Down Expand Up @@ -597,7 +597,7 @@ static Request deleteIndexTemplate(DeleteComposableIndexTemplateRequest deleteIn
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withClusterManagerTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
params.withClusterManagerTimeout(deleteIndexTemplateRequest.clusterManagerNodeTimeout());
request.addParameters(params.asMap());
return request;
}
Expand All @@ -610,7 +610,7 @@ static Request deleteAlias(DeleteAliasRequest deleteAliasRequest) {
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deleteAliasRequest.timeout());
parameters.withClusterManagerTimeout(deleteAliasRequest.masterNodeTimeout());
parameters.withClusterManagerTimeout(deleteAliasRequest.clusterManagerNodeTimeout());
request.addParameters(parameters.asMap());
return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
public abstract class TimedRequest implements Validatable {

public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30);
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);
public static final TimeValue DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);
/** @deprecated As of 2.2, 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;

private TimeValue timeout = DEFAULT_ACK_TIMEOUT;
private TimeValue clusterManagerTimeout = DEFAULT_MASTER_NODE_TIMEOUT;
private TimeValue clusterManagerTimeout = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;

/**
* Sets the timeout to wait for the all the nodes to acknowledge
Expand All @@ -61,10 +64,20 @@ public void setTimeout(TimeValue timeout) {
* Sets the timeout to connect to the cluster-manager node
* @param clusterManagerTimeout timeout as a {@link TimeValue}
*/
public void setMasterTimeout(TimeValue clusterManagerTimeout) {
public void setClusterManagerTimeout(TimeValue clusterManagerTimeout) {
this.clusterManagerTimeout = clusterManagerTimeout;
}

/**
* Sets the timeout to connect to the cluster-manager node
* @param clusterManagerTimeout timeout as a {@link TimeValue}
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerTimeout(TimeValue)}
*/
@Deprecated
public void setMasterTimeout(TimeValue clusterManagerTimeout) {
setClusterManagerTimeout(clusterManagerTimeout);
}

/**
* Returns the request timeout
*/
Expand All @@ -75,7 +88,16 @@ public TimeValue timeout() {
/**
* Returns the timeout for the request to be completed on the cluster-manager node
*/
public TimeValue masterNodeTimeout() {
public TimeValue clusterManagerNodeTimeout() {
return clusterManagerTimeout;
}

/**
* Returns the timeout for the request to be completed on the cluster-manager node
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout()}
*/
@Deprecated
public TimeValue masterNodeTimeout() {
return clusterManagerNodeTimeout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class GetComponentTemplatesRequest implements Validatable {

private final String name;

private TimeValue clusterManagerNodeTimeout = TimedRequest.DEFAULT_MASTER_NODE_TIMEOUT;
private TimeValue clusterManagerNodeTimeout = TimedRequest.DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;
private boolean local = false;

/**
Expand All @@ -67,17 +67,41 @@ public String name() {
/**
* @return the timeout for waiting for the cluster-manager node to respond
*/
public TimeValue getMasterNodeTimeout() {
public TimeValue getClusterManagerNodeTimeout() {
return clusterManagerNodeTimeout;
}

public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
/**
* @return the timeout for waiting for the cluster-manager node to respond
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
*/
@Deprecated
public TimeValue getMasterNodeTimeout() {
return getClusterManagerNodeTimeout();
}

public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
@Deprecated
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(
clusterManagerNodeTimeout,
getClass().getSimpleName() + ".clusterManagerNodeTimeout"
);
setClusterManagerNodeTimeout(timeValue);
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
@Deprecated
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(clusterManagerNodeTimeout, getClass().getSimpleName() + ".masterNodeTimeout");
setMasterNodeTimeout(timeValue);
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class GetComposableIndexTemplateRequest implements Validatable {

private final String name;

private TimeValue clusterManagerNodeTimeout = TimedRequest.DEFAULT_MASTER_NODE_TIMEOUT;
private TimeValue clusterManagerNodeTimeout = TimedRequest.DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;
private boolean local = false;

/**
Expand All @@ -67,17 +67,41 @@ public String name() {
/**
* @return the timeout for waiting for the cluster-manager node to respond
*/
public TimeValue getMasterNodeTimeout() {
public TimeValue getClusterManagerNodeTimeout() {
return clusterManagerNodeTimeout;
}

public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
/**
* @return the timeout for waiting for the cluster-manager node to respond
* @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getMasterNodeTimeout()}
*/
@Deprecated
public TimeValue getMasterNodeTimeout() {
return getClusterManagerNodeTimeout();
}

public void setClusterManagerNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
this.clusterManagerNodeTimeout = clusterManagerNodeTimeout;
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(TimeValue)} */
@Deprecated
public void setMasterNodeTimeout(@Nullable TimeValue clusterManagerNodeTimeout) {
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

public void setClusterManagerNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(
clusterManagerNodeTimeout,
getClass().getSimpleName() + ".clusterManagerNodeTimeout"
);
setClusterManagerNodeTimeout(timeValue);
}

/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #setClusterManagerNodeTimeout(String)} */
@Deprecated
public void setMasterNodeTimeout(String clusterManagerNodeTimeout) {
final TimeValue timeValue = TimeValue.parseTimeValue(clusterManagerNodeTimeout, getClass().getSimpleName() + ".masterNodeTimeout");
setMasterNodeTimeout(timeValue);
setClusterManagerNodeTimeout(clusterManagerNodeTimeout);
}

/**
Expand Down
Loading

0 comments on commit ccf1d15

Please sign in to comment.