Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvg committed Sep 25, 2018
1 parent 6f1a70c commit 2f24ad8
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import org.elasticsearch.xpack.ccr.action.ShardFollowTask;
import org.elasticsearch.xpack.ccr.action.ShardFollowTasksExecutor;
import org.elasticsearch.xpack.ccr.action.TransportCcrStatsAction;
import org.elasticsearch.xpack.ccr.action.TransportFollowAction;
import org.elasticsearch.xpack.ccr.action.TransportPutFollowAction;
import org.elasticsearch.xpack.ccr.action.TransportDeleteAutoFollowPatternAction;
import org.elasticsearch.xpack.ccr.action.TransportResumeFollowAction;
import org.elasticsearch.xpack.ccr.action.TransportPutAutoFollowPatternAction;
Expand All @@ -61,15 +61,15 @@
import org.elasticsearch.xpack.ccr.action.bulk.TransportBulkShardOperationsAction;
import org.elasticsearch.xpack.ccr.index.engine.FollowingEngineFactory;
import org.elasticsearch.xpack.ccr.rest.RestCcrStatsAction;
import org.elasticsearch.xpack.ccr.rest.RestFollowAction;
import org.elasticsearch.xpack.ccr.rest.RestPutFollowAction;
import org.elasticsearch.xpack.ccr.rest.RestDeleteAutoFollowPatternAction;
import org.elasticsearch.xpack.ccr.rest.RestResumeFollowAction;
import org.elasticsearch.xpack.ccr.rest.RestPutAutoFollowPatternAction;
import org.elasticsearch.xpack.ccr.rest.RestPauseFollowAction;
import org.elasticsearch.xpack.core.XPackPlugin;
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
import org.elasticsearch.xpack.core.ccr.action.FollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;
import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction;

Expand Down Expand Up @@ -161,7 +161,7 @@ public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(ClusterServic
new ActionHandler<>(CcrStatsAction.INSTANCE, TransportCcrStatsAction.class),
new ActionHandler<>(AutoFollowStatsAction.INSTANCE, TransportAutoFollowStatsAction.class),
// follow actions
new ActionHandler<>(FollowAction.INSTANCE, TransportFollowAction.class),
new ActionHandler<>(PutFollowAction.INSTANCE, TransportPutFollowAction.class),
new ActionHandler<>(ResumeFollowAction.INSTANCE, TransportResumeFollowAction.class),
new ActionHandler<>(PauseFollowAction.INSTANCE, TransportPauseFollowAction.class),
// auto-follow actions
Expand All @@ -183,7 +183,7 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
new RestCcrStatsAction(settings, restController),
new RestAutoFollowStatsAction(settings, restController),
// follow APIs
new RestFollowAction(settings, restController),
new RestPutFollowAction(settings, restController),
new RestResumeFollowAction(settings, restController),
new RestPauseFollowAction(settings, restController),
// auto-follow APIs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata;
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata.AutoFollowPattern;
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
import org.elasticsearch.xpack.core.ccr.action.FollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;

import java.util.ArrayList;
Expand Down Expand Up @@ -187,9 +187,9 @@ void createAndFollow(Map<String, String> headers,
Runnable successHandler,
Consumer<Exception> failureHandler) {
Client followerClient = CcrLicenseChecker.wrapClient(client, headers);
FollowAction.Request request = new FollowAction.Request(followRequest);
PutFollowAction.Request request = new PutFollowAction.Request(followRequest);
followerClient.execute(
FollowAction.INSTANCE,
PutFollowAction.INSTANCE,
request,
ActionListener.wrap(r -> successHandler.run(), failureHandler)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.elasticsearch.xpack.ccr.Ccr;
import org.elasticsearch.xpack.ccr.CcrLicenseChecker;
import org.elasticsearch.xpack.ccr.CcrSettings;
import org.elasticsearch.xpack.core.ccr.action.FollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;

import java.util.HashMap;
Expand All @@ -46,8 +46,8 @@
import java.util.Objects;
import java.util.function.Consumer;

public final class TransportFollowAction
extends TransportMasterNodeAction<FollowAction.Request, FollowAction.Response> {
public final class TransportPutFollowAction
extends TransportMasterNodeAction<PutFollowAction.Request, PutFollowAction.Response> {

private final Client client;
private final AllocationService allocationService;
Expand All @@ -56,7 +56,7 @@ public final class TransportFollowAction
private final CcrLicenseChecker ccrLicenseChecker;

@Inject
public TransportFollowAction(
public TransportPutFollowAction(
final Settings settings,
final ThreadPool threadPool,
final TransportService transportService,
Expand All @@ -68,13 +68,13 @@ public TransportFollowAction(
final CcrLicenseChecker ccrLicenseChecker) {
super(
settings,
FollowAction.NAME,
PutFollowAction.NAME,
transportService,
clusterService,
threadPool,
actionFilters,
indexNameExpressionResolver,
FollowAction.Request::new);
PutFollowAction.Request::new);
this.client = client;
this.allocationService = allocationService;
this.remoteClusterService = transportService.getRemoteClusterService();
Expand All @@ -88,15 +88,15 @@ protected String executor() {
}

@Override
protected FollowAction.Response newResponse() {
return new FollowAction.Response();
protected PutFollowAction.Response newResponse() {
return new PutFollowAction.Response();
}

@Override
protected void masterOperation(
final FollowAction.Request request,
final PutFollowAction.Request request,
final ClusterState state,
final ActionListener<FollowAction.Response> listener) throws Exception {
final ActionListener<PutFollowAction.Response> listener) throws Exception {
if (ccrLicenseChecker.isCcrAllowed() == false) {
listener.onFailure(LicenseUtils.newComplianceException("ccr"));
return;
Expand All @@ -116,9 +116,9 @@ protected void masterOperation(
}

private void createFollowerIndexAndFollowLocalIndex(
final FollowAction.Request request,
final PutFollowAction.Request request,
final ClusterState state,
final ActionListener<FollowAction.Response> listener) {
final ActionListener<PutFollowAction.Response> listener) {
// following an index in local cluster, so use local cluster state to fetch leader index metadata
final String leaderIndex = request.getFollowRequest().getLeaderIndex();
final IndexMetaData leaderIndexMetadata = state.getMetaData().index(leaderIndex);
Expand All @@ -134,10 +134,10 @@ private void createFollowerIndexAndFollowLocalIndex(
}

private void createFollowerIndexAndFollowRemoteIndex(
final FollowAction.Request request,
final PutFollowAction.Request request,
final String clusterAlias,
final String leaderIndex,
final ActionListener<FollowAction.Response> listener) {
final ActionListener<PutFollowAction.Response> listener) {
ccrLicenseChecker.checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
client,
clusterAlias,
Expand All @@ -149,8 +149,8 @@ private void createFollowerIndexAndFollowRemoteIndex(
private void createFollowerIndex(
final IndexMetaData leaderIndexMetaData,
final String[] historyUUIDs,
final FollowAction.Request request,
final ActionListener<FollowAction.Response> listener) {
final PutFollowAction.Request request,
final ActionListener<PutFollowAction.Response> listener) {
if (leaderIndexMetaData == null) {
listener.onFailure(new IllegalArgumentException("leader index [" + request.getFollowRequest().getLeaderIndex() +
"] does not exist"));
Expand All @@ -162,7 +162,7 @@ private void createFollowerIndex(
if (result) {
initiateFollowing(request, listener);
} else {
listener.onResponse(new FollowAction.Response(true, false, false));
listener.onResponse(new PutFollowAction.Response(true, false, false));
}
},
listener::onFailure);
Expand Down Expand Up @@ -228,23 +228,23 @@ public ClusterState execute(final ClusterState currentState) throws Exception {
}

private void initiateFollowing(
final FollowAction.Request request,
final ActionListener<FollowAction.Response> listener) {
final PutFollowAction.Request request,
final ActionListener<PutFollowAction.Response> listener) {
activeShardsObserver.waitForActiveShards(new String[]{request.getFollowRequest().getFollowerIndex()},
ActiveShardCount.DEFAULT, request.timeout(), result -> {
if (result) {
client.execute(ResumeFollowAction.INSTANCE, request.getFollowRequest(), ActionListener.wrap(
r -> listener.onResponse(new FollowAction.Response(true, true, r.isAcknowledged())),
r -> listener.onResponse(new PutFollowAction.Response(true, true, r.isAcknowledged())),
listener::onFailure
));
} else {
listener.onResponse(new FollowAction.Response(true, false, false));
listener.onResponse(new PutFollowAction.Response(true, false, false));
}
}, listener::onFailure);
}

@Override
protected ClusterBlockException checkBlock(final FollowAction.Request request, final ClusterState state) {
protected ClusterBlockException checkBlock(final PutFollowAction.Request request, final ClusterState state) {
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA_WRITE, request.getFollowRequest().getFollowerIndex());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

import java.io.IOException;

import static org.elasticsearch.xpack.core.ccr.action.FollowAction.INSTANCE;
import static org.elasticsearch.xpack.core.ccr.action.FollowAction.Request;
import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.INSTANCE;
import static org.elasticsearch.xpack.core.ccr.action.PutFollowAction.Request;

public class RestFollowAction extends BaseRestHandler {
public class RestPutFollowAction extends BaseRestHandler {

public RestFollowAction(Settings settings, RestController controller) {
public RestPutFollowAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_ccr/follow", this);
}

@Override
public String getName() {
return "ccr_follow_action";
return "ccr_put_follow_action";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.elasticsearch.test.MockLogAppender;
import org.elasticsearch.xpack.ccr.action.AutoFollowCoordinator;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
import org.elasticsearch.xpack.core.ccr.action.FollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata;
import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata.AutoFollowPattern;
Expand Down Expand Up @@ -67,14 +67,14 @@ public void onFailure(final Exception e) {

public void testThatCreateAndFollowingIndexIsUnavailableWithNonCompliantLicense() throws InterruptedException {
final ResumeFollowAction.Request followRequest = getFollowRequest();
final FollowAction.Request createAndFollowRequest = new FollowAction.Request(followRequest);
final PutFollowAction.Request createAndFollowRequest = new PutFollowAction.Request(followRequest);
final CountDownLatch latch = new CountDownLatch(1);
client().execute(
FollowAction.INSTANCE,
PutFollowAction.INSTANCE,
createAndFollowRequest,
new ActionListener<FollowAction.Response>() {
new ActionListener<PutFollowAction.Response>() {
@Override
public void onResponse(final FollowAction.Response response) {
public void onResponse(final PutFollowAction.Response response) {
latch.countDown();
fail();
}
Expand Down
Loading

0 comments on commit 2f24ad8

Please sign in to comment.