simplify support transport actions, no need to provide several action paths, we can derive them
This commit is contained in:
parent
a793336635
commit
ed1d1249fc
|
@ -60,11 +60,6 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction<Node
|
|||
return TransportActions.Admin.Cluster.Node.INFO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/cluster/nodes/info/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NodesInfoResponse newResponse(NodesInfoRequest nodesInfoRequest, AtomicReferenceArray responses) {
|
||||
final List<NodeInfo> nodesInfos = new ArrayList<NodeInfo>();
|
||||
|
|
|
@ -79,11 +79,6 @@ public class TransportNodesRestartAction extends TransportNodesOperationAction<N
|
|||
return TransportActions.Admin.Cluster.Node.RESTART;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/cluster/nodes/restart/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NodesRestartResponse newResponse(NodesRestartRequest nodesShutdownRequest, AtomicReferenceArray responses) {
|
||||
final List<NodesRestartResponse.NodeRestartResponse> nodeRestartResponses = newArrayList();
|
||||
|
|
|
@ -60,11 +60,6 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
|
|||
return TransportActions.Admin.Cluster.Node.STATS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/cluster/nodes/stats/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NodesStatsResponse newResponse(NodesStatsRequest nodesInfoRequest, AtomicReferenceArray responses) {
|
||||
final List<NodeStats> nodeStats = Lists.newArrayList();
|
||||
|
|
|
@ -59,11 +59,6 @@ public class TransportBroadcastPingAction extends TransportBroadcastOperationAct
|
|||
return TransportActions.Admin.Cluster.Ping.BROADCAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "/cluster/ping/broadcast/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BroadcastPingRequest newRequest() {
|
||||
return new BroadcastPingRequest();
|
||||
|
|
|
@ -50,11 +50,6 @@ public class TransportSinglePingAction extends TransportShardSingleOperationActi
|
|||
return TransportActions.Admin.Cluster.Ping.SINGLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "/cluster/ping/single/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShardIterator shards(ClusterState clusterState, SinglePingRequest request) throws ElasticSearchException {
|
||||
return clusterService.operationRouting()
|
||||
|
|
|
@ -86,11 +86,6 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction
|
|||
return TransportActions.Admin.Indices.ANALYZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/analyze/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShardsIterator shards(ClusterState clusterState, AnalyzeRequest request) {
|
||||
if (request.index() == null) {
|
||||
|
|
|
@ -43,8 +43,6 @@ import static com.google.common.collect.Lists.newArrayList;
|
|||
|
||||
/**
|
||||
* Indices clear cache action.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TransportClearIndicesCacheAction extends TransportBroadcastOperationAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ShardClearIndicesCacheRequest, ShardClearIndicesCacheResponse> {
|
||||
|
||||
|
@ -67,12 +65,6 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
return TransportActions.Admin.Indices.Cache.CLEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/cache/clear/shard";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ClearIndicesCacheRequest newRequest() {
|
||||
return new ClearIndicesCacheRequest();
|
||||
|
|
|
@ -44,8 +44,6 @@ import static com.google.common.collect.Lists.newArrayList;
|
|||
|
||||
/**
|
||||
* Flush Action.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TransportFlushAction extends TransportBroadcastOperationAction<FlushRequest, FlushResponse, ShardFlushRequest, ShardFlushResponse> {
|
||||
|
||||
|
@ -67,11 +65,6 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
|
|||
return TransportActions.Admin.Indices.FLUSH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/flush/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FlushRequest newRequest() {
|
||||
return new FlushRequest();
|
||||
|
|
|
@ -64,11 +64,6 @@ public class TransportGatewaySnapshotAction extends TransportBroadcastOperationA
|
|||
return TransportActions.Admin.Indices.Gateway.SNAPSHOT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/gateway/snapshot/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GatewaySnapshotRequest newRequest() {
|
||||
return new GatewaySnapshotRequest();
|
||||
|
|
|
@ -44,8 +44,6 @@ import static com.google.common.collect.Lists.newArrayList;
|
|||
|
||||
/**
|
||||
* Optimize index/indices action.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TransportOptimizeAction extends TransportBroadcastOperationAction<OptimizeRequest, OptimizeResponse, ShardOptimizeRequest, ShardOptimizeResponse> {
|
||||
|
||||
|
@ -70,11 +68,6 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
|
|||
return TransportActions.Admin.Indices.OPTIMIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/optimize/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OptimizeRequest newRequest() {
|
||||
return new OptimizeRequest();
|
||||
|
|
|
@ -70,11 +70,6 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
|
|||
return TransportActions.Admin.Indices.REFRESH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/refresh/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RefreshRequest newRequest() {
|
||||
return new RefreshRequest();
|
||||
|
|
|
@ -70,11 +70,6 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
|
|||
return TransportActions.Admin.Indices.SEGMENTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/segments/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IndicesSegmentsRequest newRequest() {
|
||||
return new IndicesSegmentsRequest();
|
||||
|
|
|
@ -70,11 +70,6 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
|
|||
return TransportActions.Admin.Indices.STATS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/stats/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IndicesStatsRequest newRequest() {
|
||||
return new IndicesStatsRequest();
|
||||
|
|
|
@ -79,11 +79,6 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
|
|||
return TransportActions.Admin.Indices.STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/status/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IndicesStatusRequest newRequest() {
|
||||
return new IndicesStatusRequest();
|
||||
|
|
|
@ -69,11 +69,6 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
return TransportActions.Admin.Indices.VALIDATE_QUERY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return "indices/validateQuery/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ValidateQueryRequest newRequest() {
|
||||
return new ValidateQueryRequest();
|
||||
|
|
|
@ -67,11 +67,6 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
|
|||
return TransportActions.COUNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return TransportActions.COUNT + "/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CountRequest newRequest() {
|
||||
return new CountRequest();
|
||||
|
|
|
@ -66,11 +66,6 @@ public class TransportGetAction extends TransportShardSingleOperationAction<GetR
|
|||
return TransportActions.GET;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return TransportActions.GET + "/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBlock(GetRequest request, ClusterState state) {
|
||||
state.blocks().indexBlockedRaiseException(ClusterBlockLevel.READ, request.index());
|
||||
|
|
|
@ -63,11 +63,6 @@ public class TransportShardMultiGetAction extends TransportShardSingleOperationA
|
|||
return TransportActions.MULTI_GET + "/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return TransportActions.MULTI_GET + "/shard/s";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MultiGetShardRequest newRequest() {
|
||||
return new MultiGetShardRequest();
|
||||
|
|
|
@ -68,11 +68,6 @@ public class TransportPercolateAction extends TransportSingleCustomOperationActi
|
|||
return TransportActions.PERCOLATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportShardAction() {
|
||||
return TransportActions.PERCOLATE + "/shard";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) {
|
||||
request.index(clusterState.metaData().concreteIndex(request.index()));
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||
this.threadPool = threadPool;
|
||||
|
||||
this.transportAction = transportAction();
|
||||
this.transportShardAction = transportShardAction();
|
||||
this.transportShardAction = transportAction() + "/s";
|
||||
this.executor = executor();
|
||||
|
||||
transportService.registerHandler(transportAction, new TransportHandler());
|
||||
|
@ -74,8 +74,6 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||
|
||||
protected abstract String transportAction();
|
||||
|
||||
protected abstract String transportShardAction();
|
||||
|
||||
protected abstract String executor();
|
||||
|
||||
protected abstract Request newRequest();
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
|
|||
this.transportService = transportService;
|
||||
|
||||
this.transportAction = transportAction();
|
||||
this.transportNodeAction = transportNodeAction();
|
||||
this.transportNodeAction = transportAction() + "/n";
|
||||
this.executor = executor();
|
||||
|
||||
transportService.registerHandler(transportAction, new TransportHandler());
|
||||
|
@ -75,8 +75,6 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
|
|||
|
||||
protected abstract String transportAction();
|
||||
|
||||
protected abstract String transportNodeAction();
|
||||
|
||||
protected boolean transportCompress() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
|
|||
this.transportService = transportService;
|
||||
|
||||
this.transportAction = transportAction();
|
||||
this.transportShardAction = transportShardAction();
|
||||
this.transportShardAction = transportAction() + "/s";
|
||||
this.executor = executor();
|
||||
|
||||
transportService.registerHandler(transportAction, new TransportHandler());
|
||||
|
@ -72,8 +72,6 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
|
|||
|
||||
protected abstract String transportAction();
|
||||
|
||||
protected abstract String transportShardAction();
|
||||
|
||||
protected abstract String executor();
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
|
|||
this.transportService = transportService;
|
||||
|
||||
this.transportAction = transportAction();
|
||||
this.transportShardAction = transportShardAction();
|
||||
this.transportShardAction = transportAction() + "/s";
|
||||
this.executor = executor();
|
||||
|
||||
transportService.registerHandler(transportAction, new TransportHandler());
|
||||
|
@ -73,8 +73,6 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
|
|||
|
||||
protected abstract String transportAction();
|
||||
|
||||
protected abstract String transportShardAction();
|
||||
|
||||
protected abstract String executor();
|
||||
|
||||
protected abstract Response shardOperation(Request request, int shardId) throws ElasticSearchException;
|
||||
|
|
|
@ -72,11 +72,6 @@ public class TransportNodesListGatewayMetaState extends TransportNodesOperationA
|
|||
return "/gateway/local/meta-state";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/gateway/local/meta-state/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean transportCompress() {
|
||||
return true; // compress since the metadata can become large
|
||||
|
|
|
@ -74,11 +74,6 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesOperat
|
|||
return "/gateway/local/started-shards";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/gateway/local/started-shards/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean transportCompress() {
|
||||
return true; // this can become big...
|
||||
|
|
|
@ -86,11 +86,6 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesOperatio
|
|||
return "/cluster/nodes/indices/shard/store";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String transportNodeAction() {
|
||||
return "/cluster/nodes/indices/shard/store/node";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request newRequest() {
|
||||
return new Request();
|
||||
|
|
Loading…
Reference in New Issue