This commit converts all MasterNodeRequest subclasses to fullfill Writeable.Reader constructors. relates #34389
This commit is contained in:
parent
7114fe786b
commit
17c4b2b839
|
@ -243,9 +243,4 @@ public class ClusterAllocationExplainRequest extends MasterNodeRequest<ClusterAl
|
|||
public static ClusterAllocationExplainRequest parse(XContentParser parser) throws IOException {
|
||||
return PARSER.parse(parser, new ClusterAllocationExplainRequest(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,11 +118,6 @@ public class AddVotingConfigExclusionsRequest extends MasterNodeRequest<AddVotin
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -83,11 +83,6 @@ public class ClearVotingConfigExclusionsRequest extends MasterNodeRequest<ClearV
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -283,11 +283,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest<ClusterHealthReq
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
public enum Level {
|
||||
CLUSTER, INDICES, SHARDS
|
||||
}
|
||||
|
|
|
@ -93,9 +93,4 @@ public class GetRepositoriesRequest extends MasterNodeReadRequest<GetRepositorie
|
|||
this.repositories = repositories;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,9 +148,4 @@ public class ClusterSearchShardsRequest extends MasterNodeReadRequest<ClusterSea
|
|||
public String preference() {
|
||||
return this.preference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -482,11 +482,6 @@ public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotReque
|
|||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "snapshot [" + repository + ":" + snapshot + "]";
|
||||
|
|
|
@ -125,9 +125,4 @@ public class DeleteSnapshotRequest extends MasterNodeRequest<DeleteSnapshotReque
|
|||
this.snapshot = snapshot;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,9 +171,4 @@ public class GetSnapshotsRequest extends MasterNodeRequest<GetSnapshotsRequest>
|
|||
public boolean verbose() {
|
||||
return verbose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -609,11 +609,6 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
|
|||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "snapshot [" + repository + ":" + snapshot + "]";
|
||||
|
|
|
@ -149,9 +149,4 @@ public class SnapshotsStatusRequest extends MasterNodeRequest<SnapshotsStatusReq
|
|||
public boolean ignoreUnavailable() {
|
||||
return ignoreUnavailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,9 +191,4 @@ public class ClusterStateRequest extends MasterNodeReadRequest<ClusterStateReque
|
|||
this.waitForMetaDataVersion = waitForMetaDataVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,11 +86,6 @@ public class GetStoredScriptRequest extends MasterNodeReadRequest<GetStoredScrip
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "get script [" + id + "]";
|
||||
|
|
|
@ -118,9 +118,4 @@ public class GetAliasesRequest extends MasterNodeReadRequest<GetAliasesRequest>
|
|||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,9 +94,4 @@ public class IndicesExistsRequest extends MasterNodeReadRequest<IndicesExistsReq
|
|||
}
|
||||
return validationException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,4 @@ public class TypesExistsRequest extends MasterNodeReadRequest<TypesExistsRequest
|
|||
|
||||
return validationException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,11 +142,6 @@ public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
|
|||
return includeDefaults;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -129,11 +129,6 @@ public class GetSettingsRequest extends MasterNodeReadRequest<GetSettingsRequest
|
|||
return validationException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -128,9 +128,4 @@ public class IndicesShardStoresRequest extends MasterNodeReadRequest<IndicesShar
|
|||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,11 @@ public class DeleteIndexTemplateRequest extends MasterNodeRequest<DeleteIndexTem
|
|||
|
||||
private String name;
|
||||
|
||||
public DeleteIndexTemplateRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
name = in.readString();
|
||||
}
|
||||
|
||||
public DeleteIndexTemplateRequest() {
|
||||
}
|
||||
|
||||
|
@ -68,12 +73,6 @@ public class DeleteIndexTemplateRequest extends MasterNodeRequest<DeleteIndexTem
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
name = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class TransportDeleteIndexTemplateAction
|
|||
ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService,
|
||||
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(DeleteIndexTemplateAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, DeleteIndexTemplateRequest::new);
|
||||
DeleteIndexTemplateRequest::new, indexNameExpressionResolver);
|
||||
this.indexTemplateService = indexTemplateService;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,9 +82,4 @@ public class GetIndexTemplatesRequest extends MasterNodeReadRequest<GetIndexTemp
|
|||
public String[] names() {
|
||||
return this.names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,40 @@ public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateR
|
|||
|
||||
private Integer version;
|
||||
|
||||
public PutIndexTemplateRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
cause = in.readString();
|
||||
name = in.readString();
|
||||
|
||||
if (in.getVersion().onOrAfter(Version.V_6_0_0_alpha1)) {
|
||||
indexPatterns = in.readStringList();
|
||||
} else {
|
||||
indexPatterns = Collections.singletonList(in.readString());
|
||||
}
|
||||
order = in.readInt();
|
||||
create = in.readBoolean();
|
||||
settings = readSettingsFromStream(in);
|
||||
int size = in.readVInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
final String type = in.readString();
|
||||
String mappingSource = in.readString();
|
||||
mappings.put(type, mappingSource);
|
||||
}
|
||||
if (in.getVersion().before(Version.V_6_5_0)) {
|
||||
// Used to be used for custom index metadata
|
||||
int customSize = in.readVInt();
|
||||
assert customSize == 0 : "expected not to have any custom metadata";
|
||||
if (customSize > 0) {
|
||||
throw new IllegalStateException("unexpected custom metadata when none is supported");
|
||||
}
|
||||
}
|
||||
int aliasesSize = in.readVInt();
|
||||
for (int i = 0; i < aliasesSize; i++) {
|
||||
aliases.add(Alias.read(in));
|
||||
}
|
||||
version = in.readOptionalVInt();
|
||||
}
|
||||
|
||||
public PutIndexTemplateRequest() {
|
||||
}
|
||||
|
||||
|
@ -454,41 +488,6 @@ public class PutIndexTemplateRequest extends MasterNodeRequest<PutIndexTemplateR
|
|||
return IndicesOptions.strictExpand();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
cause = in.readString();
|
||||
name = in.readString();
|
||||
|
||||
if (in.getVersion().onOrAfter(Version.V_6_0_0_alpha1)) {
|
||||
indexPatterns = in.readStringList();
|
||||
} else {
|
||||
indexPatterns = Collections.singletonList(in.readString());
|
||||
}
|
||||
order = in.readInt();
|
||||
create = in.readBoolean();
|
||||
settings = readSettingsFromStream(in);
|
||||
int size = in.readVInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
final String type = in.readString();
|
||||
String mappingSource = in.readString();
|
||||
mappings.put(type, mappingSource);
|
||||
}
|
||||
if (in.getVersion().before(Version.V_6_5_0)) {
|
||||
// Used to be used for custom index metadata
|
||||
int customSize = in.readVInt();
|
||||
assert customSize == 0 : "expected not to have any custom metadata";
|
||||
if (customSize > 0) {
|
||||
throw new IllegalStateException("unexpected custom metadata when none is supported");
|
||||
}
|
||||
}
|
||||
int aliasesSize = in.readVInt();
|
||||
for (int i = 0; i < aliasesSize; i++) {
|
||||
aliases.add(Alias.read(in));
|
||||
}
|
||||
version = in.readOptionalVInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction<P
|
|||
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
IndexScopedSettings indexScopedSettings) {
|
||||
super(PutIndexTemplateAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, PutIndexTemplateRequest::new);
|
||||
PutIndexTemplateRequest::new, indexNameExpressionResolver);
|
||||
this.indexTemplateService = indexTemplateService;
|
||||
this.indexScopedSettings = indexScopedSettings;
|
||||
}
|
||||
|
|
|
@ -61,9 +61,4 @@ public class GetPipelineRequest extends MasterNodeReadRequest<GetPipelineRequest
|
|||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,11 +81,6 @@ public abstract class AcknowledgedRequest<Request extends MasterNodeRequest<Requ
|
|||
return timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -59,9 +59,4 @@ public abstract class MasterNodeReadRequest<Request extends MasterNodeReadReques
|
|||
public final boolean local() {
|
||||
return local;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,11 +70,8 @@ public abstract class MasterNodeRequest<Request extends MasterNodeRequest<Reques
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
// TODO(talevy): throw exception once all MasterNodeRequest
|
||||
// subclasses have been migrated to Writeable Readers
|
||||
super.readFrom(in);
|
||||
masterNodeTimeout = in.readTimeValue();
|
||||
public final void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,14 +86,4 @@ public abstract class ClusterInfoRequest<Request extends ClusterInfoRequest<Requ
|
|||
public IndicesOptions indicesOptions() {
|
||||
return indicesOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
// TODO(talevy): once all ClusterInfoRequest objects are converted, remove this
|
||||
super.readFrom(in);
|
||||
indices = in.readStringArray();
|
||||
types = in.readStringArray();
|
||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
||||
// throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,13 @@ public class CompletionPersistentTaskAction extends StreamableResponseActionType
|
|||
|
||||
private long allocationId = -1;
|
||||
|
||||
public Request() {
|
||||
public Request() {}
|
||||
|
||||
public Request(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
taskId = in.readString();
|
||||
allocationId = in.readLong();
|
||||
exception = in.readException();
|
||||
}
|
||||
|
||||
public Request(String taskId, long allocationId, Exception exception) {
|
||||
|
@ -78,14 +83,6 @@ public class CompletionPersistentTaskAction extends StreamableResponseActionType
|
|||
this.allocationId = allocationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
taskId = in.readString();
|
||||
allocationId = in.readLong();
|
||||
exception = in.readException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -140,7 +137,7 @@ public class CompletionPersistentTaskAction extends StreamableResponseActionType
|
|||
PersistentTasksClusterService persistentTasksClusterService,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(CompletionPersistentTaskAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, Request::new);
|
||||
Request::new, indexNameExpressionResolver);
|
||||
this.persistentTasksClusterService = persistentTasksClusterService;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,11 @@ public class RemovePersistentTaskAction extends StreamableResponseActionType<Per
|
|||
|
||||
private String taskId;
|
||||
|
||||
public Request() {
|
||||
public Request() {}
|
||||
|
||||
public Request(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
taskId = in.readString();
|
||||
}
|
||||
|
||||
public Request(String taskId) {
|
||||
|
@ -70,12 +73,6 @@ public class RemovePersistentTaskAction extends StreamableResponseActionType<Per
|
|||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
taskId = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -125,7 +122,7 @@ public class RemovePersistentTaskAction extends StreamableResponseActionType<Per
|
|||
PersistentTasksClusterService persistentTasksClusterService,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(RemovePersistentTaskAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, Request::new);
|
||||
Request::new, indexNameExpressionResolver);
|
||||
this.persistentTasksClusterService = persistentTasksClusterService;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,19 +69,10 @@ public class StartPersistentTaskAction extends StreamableResponseActionType<Pers
|
|||
|
||||
private PersistentTaskParams params;
|
||||
|
||||
public Request() {
|
||||
public Request() {}
|
||||
|
||||
}
|
||||
|
||||
public Request(String taskId, String taskName, PersistentTaskParams params) {
|
||||
this.taskId = taskId;
|
||||
this.taskName = taskName;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
public Request(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
taskId = in.readString();
|
||||
taskName = in.readString();
|
||||
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
|
@ -91,6 +82,12 @@ public class StartPersistentTaskAction extends StreamableResponseActionType<Pers
|
|||
}
|
||||
}
|
||||
|
||||
public Request(String taskId, String taskName, PersistentTaskParams params) {
|
||||
this.taskId = taskId;
|
||||
this.taskName = taskName;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -198,7 +195,7 @@ public class StartPersistentTaskAction extends StreamableResponseActionType<Pers
|
|||
PersistentTasksService persistentTasksService,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(StartPersistentTaskAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, Request::new);
|
||||
Request::new, indexNameExpressionResolver);
|
||||
this.persistentTasksClusterService = persistentTasksClusterService;
|
||||
NodePersistentTasksExecutor executor = new NodePersistentTasksExecutor(threadPool);
|
||||
clusterService.addListener(new PersistentTasksNodeService(persistentTasksService, persistentTasksExecutorRegistry,
|
||||
|
|
|
@ -62,7 +62,13 @@ public class UpdatePersistentTaskStatusAction extends StreamableResponseActionTy
|
|||
private long allocationId = -1L;
|
||||
private PersistentTaskState state;
|
||||
|
||||
public Request() {
|
||||
public Request() {}
|
||||
|
||||
public Request(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
taskId = in.readString();
|
||||
allocationId = in.readLong();
|
||||
state = in.readOptionalNamedWriteable(PersistentTaskState.class);
|
||||
}
|
||||
|
||||
public Request(String taskId, long allocationId, PersistentTaskState state) {
|
||||
|
@ -83,14 +89,6 @@ public class UpdatePersistentTaskStatusAction extends StreamableResponseActionTy
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
taskId = in.readString();
|
||||
allocationId = in.readLong();
|
||||
state = in.readOptionalNamedWriteable(PersistentTaskState.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -155,7 +153,7 @@ public class UpdatePersistentTaskStatusAction extends StreamableResponseActionTy
|
|||
PersistentTasksClusterService persistentTasksClusterService,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(UpdatePersistentTaskStatusAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, Request::new);
|
||||
Request::new, indexNameExpressionResolver);
|
||||
this.persistentTasksClusterService = persistentTasksClusterService;
|
||||
}
|
||||
|
||||
|
|
|
@ -426,8 +426,13 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
private ShardId shardId;
|
||||
private ShardSnapshotStatus status;
|
||||
|
||||
public UpdateIndexShardSnapshotStatusRequest() {
|
||||
public UpdateIndexShardSnapshotStatusRequest() {}
|
||||
|
||||
public UpdateIndexShardSnapshotStatusRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
snapshot = new Snapshot(in);
|
||||
shardId = new ShardId(in);
|
||||
status = new ShardSnapshotStatus(in);
|
||||
}
|
||||
|
||||
public UpdateIndexShardSnapshotStatusRequest(Snapshot snapshot, ShardId shardId, ShardSnapshotStatus status) {
|
||||
|
@ -443,14 +448,6 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
snapshot = new Snapshot(in);
|
||||
shardId = new ShardId(in);
|
||||
status = new ShardSnapshotStatus(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -619,7 +616,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(
|
||||
SnapshotShardsService.UPDATE_SNAPSHOT_STATUS_ACTION_NAME, transportService, clusterService, threadPool,
|
||||
actionFilters, indexNameExpressionResolver, UpdateIndexShardSnapshotStatusRequest::new
|
||||
actionFilters, UpdateIndexShardSnapshotStatusRequest::new, indexNameExpressionResolver
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,13 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu
|
|||
private String key;
|
||||
private String value;
|
||||
|
||||
Request() {
|
||||
Request() {}
|
||||
|
||||
Request(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
index = in.readString();
|
||||
key = in.readString();
|
||||
value = in.readString();
|
||||
}
|
||||
|
||||
public Request(final String index, final String key, final String value) {
|
||||
|
@ -92,14 +97,6 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(final StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
index = in.readString();
|
||||
key = in.readString();
|
||||
value = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(final StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
@ -138,8 +135,8 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu
|
|||
clusterService,
|
||||
threadPool,
|
||||
actionFilters,
|
||||
indexNameExpressionResolver,
|
||||
UpdateInternalOrPrivateAction.Request::new);
|
||||
UpdateInternalOrPrivateAction.Request::new,
|
||||
indexNameExpressionResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
*/
|
||||
package org.elasticsearch.persistent;
|
||||
|
||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.persistent.RemovePersistentTaskAction.Request;
|
||||
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||
|
||||
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiOfLength;
|
||||
|
||||
public class CancelPersistentTaskRequestTests extends AbstractStreamableTestCase<Request> {
|
||||
public class CancelPersistentTaskRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
|
@ -31,7 +32,7 @@ public class CancelPersistentTaskRequestTests extends AbstractStreamableTestCase
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
*/
|
||||
package org.elasticsearch.persistent;
|
||||
|
||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.persistent.CompletionPersistentTaskAction.Request;
|
||||
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||
|
||||
public class RestartPersistentTaskRequestTests extends AbstractStreamableTestCase<Request> {
|
||||
public class RestartPersistentTaskRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
|
@ -29,7 +30,7 @@ public class RestartPersistentTaskRequestTests extends AbstractStreamableTestCas
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,14 +21,15 @@ package org.elasticsearch.persistent;
|
|||
import org.elasticsearch.common.UUIDs;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry.Entry;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.persistent.StartPersistentTaskAction.Request;
|
||||
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestParams;
|
||||
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor;
|
||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class StartPersistentActionRequestTests extends AbstractStreamableTestCase<Request> {
|
||||
public class StartPersistentActionRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
|
@ -43,8 +44,8 @@ public class StartPersistentActionRequestTests extends AbstractStreamableTestCas
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,14 +20,15 @@ package org.elasticsearch.persistent;
|
|||
|
||||
import org.elasticsearch.common.UUIDs;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.persistent.TestPersistentTasksPlugin.State;
|
||||
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor;
|
||||
import org.elasticsearch.persistent.UpdatePersistentTaskStatusAction.Request;
|
||||
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class UpdatePersistentTaskRequestTests extends AbstractStreamableTestCase<Request> {
|
||||
public class UpdatePersistentTaskRequestTests extends AbstractWireSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
|
@ -35,8 +36,8 @@ public class UpdatePersistentTaskRequestTests extends AbstractStreamableTestCase
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,19 @@ public class PostStartTrialRequest extends MasterNodeRequest<PostStartTrialReque
|
|||
private boolean acknowledge = false;
|
||||
private String type;
|
||||
|
||||
public PostStartTrialRequest() {}
|
||||
|
||||
public PostStartTrialRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
type = in.readString();
|
||||
acknowledge = in.readBoolean();
|
||||
} else {
|
||||
type = "trial";
|
||||
acknowledge = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
|
@ -41,18 +54,6 @@ public class PostStartTrialRequest extends MasterNodeRequest<PostStartTrialReque
|
|||
return acknowledge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
|
||||
type = in.readString();
|
||||
acknowledge = in.readBoolean();
|
||||
} else {
|
||||
type = "trial";
|
||||
acknowledge = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
Version version = Version.V_6_3_0;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TransportPostStartTrialAction extends StreamableTransportMasterNode
|
|||
LicenseService licenseService, ThreadPool threadPool, ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(PostStartTrialAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, PostStartTrialRequest::new);
|
||||
PostStartTrialRequest::new, indexNameExpressionResolver);
|
||||
this.licenseService = licenseService;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,18 @@ package org.elasticsearch.protocol.xpack;
|
|||
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.support.master.MasterNodeRequest;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class XPackUsageRequest extends MasterNodeRequest<XPackUsageRequest> {
|
||||
|
||||
public XPackUsageRequest() {}
|
||||
|
||||
public XPackUsageRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
|
|
|
@ -64,11 +64,6 @@ public class IndexUpgradeInfoRequest extends MasterNodeReadRequest<IndexUpgradeI
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -36,8 +36,8 @@ public class TransportXPackUsageAction extends StreamableTransportMasterNodeActi
|
|||
public TransportXPackUsageAction(ThreadPool threadPool, TransportService transportService,
|
||||
ClusterService clusterService, ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver, Set<XPackFeatureSet> featureSets) {
|
||||
super(XPackUsageAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver,
|
||||
XPackUsageRequest::new);
|
||||
super(XPackUsageAction.NAME, transportService, clusterService, threadPool, actionFilters, XPackUsageRequest::new,
|
||||
indexNameExpressionResolver);
|
||||
this.featureSets = Collections.unmodifiableList(new ArrayList<>(featureSets));
|
||||
}
|
||||
|
||||
|
|
|
@ -270,11 +270,6 @@ public class DeprecationInfoAction extends StreamableResponseActionType<Deprecat
|
|||
return validationException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -51,11 +51,6 @@ public class FinalizeJobExecutionAction extends ActionType<AcknowledgedResponse>
|
|||
return jobIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -84,11 +84,6 @@ public class GetDatafeedsAction extends ActionType<GetDatafeedsAction.Response>
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(datafeedId, allowNoDatafeeds);
|
||||
|
|
|
@ -96,11 +96,6 @@ public class GetDatafeedsStatsAction extends ActionType<GetDatafeedsStatsAction.
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(datafeedId, allowNoDatafeeds);
|
||||
|
|
|
@ -82,11 +82,6 @@ public class GetJobsAction extends ActionType<GetJobsAction.Response> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(jobId, allowNoJobs);
|
||||
|
|
|
@ -74,7 +74,8 @@ public class OpenJobAction extends ActionType<AcknowledgedResponse> {
|
|||
}
|
||||
|
||||
public Request(StreamInput in) throws IOException {
|
||||
readFrom(in);
|
||||
super(in);
|
||||
jobParams = new JobParams(in);
|
||||
}
|
||||
|
||||
public Request() {
|
||||
|
@ -89,12 +90,6 @@ public class OpenJobAction extends ActionType<AcknowledgedResponse> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
jobParams = new JobParams(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -86,7 +86,8 @@ public class StartDatafeedAction extends ActionType<AcknowledgedResponse> {
|
|||
}
|
||||
|
||||
public Request(StreamInput in) throws IOException {
|
||||
readFrom(in);
|
||||
super(in);
|
||||
params = new DatafeedParams(in);
|
||||
}
|
||||
|
||||
public Request() {
|
||||
|
@ -107,12 +108,6 @@ public class StartDatafeedAction extends ActionType<AcknowledgedResponse> {
|
|||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
params = new DatafeedParams(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -113,11 +113,6 @@ public class IndexUpgradeAction extends StreamableResponseActionType<BulkByScrol
|
|||
return validationException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -20,6 +20,11 @@ public class WatcherServiceRequest extends MasterNodeRequest<WatcherServiceReque
|
|||
|
||||
private Command command;
|
||||
|
||||
public WatcherServiceRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
command = Command.valueOf(in.readString().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public WatcherServiceRequest() {
|
||||
}
|
||||
|
||||
|
@ -52,12 +57,6 @@ public class WatcherServiceRequest extends MasterNodeRequest<WatcherServiceReque
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
command = Command.valueOf(in.readString().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
|
|
|
@ -5,27 +5,28 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.core.ml.action;
|
||||
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
|
||||
import org.elasticsearch.test.AbstractSerializingTestCase;
|
||||
import org.elasticsearch.xpack.core.ml.action.OpenJobAction.Request;
|
||||
|
||||
public class OpenJobActionRequestTests extends AbstractStreamableXContentTestCase<Request> {
|
||||
public class OpenJobActionRequestTests extends AbstractSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
return new Request(JobParamsTests.createJobParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request doParseInstance(XContentParser parser) {
|
||||
return Request.parseRequest(null, parser);
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
package org.elasticsearch.xpack.core.ml.action;
|
||||
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
|
||||
import org.elasticsearch.test.AbstractSerializingTestCase;
|
||||
import org.elasticsearch.xpack.core.ml.action.StartDatafeedAction.Request;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class StartDatafeedActionRequestTests extends AbstractStreamableXContentTestCase<Request> {
|
||||
public class StartDatafeedActionRequestTests extends AbstractSerializingTestCase<Request> {
|
||||
|
||||
@Override
|
||||
protected Request createTestInstance() {
|
||||
|
@ -20,13 +21,13 @@ public class StartDatafeedActionRequestTests extends AbstractStreamableXContentT
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
protected Writeable.Reader<Request> instanceReader() {
|
||||
return Request::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Request createBlankInstance() {
|
||||
return new Request();
|
||||
protected boolean supportsUnknownFields() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TransportWatcherServiceAction extends TransportMasterNodeAction<Wat
|
|||
ThreadPool threadPool, ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(WatcherServiceAction.NAME, transportService, clusterService, threadPool, actionFilters,
|
||||
indexNameExpressionResolver, WatcherServiceRequest::new);
|
||||
WatcherServiceRequest::new, indexNameExpressionResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue