Replace (read|write)AggregatorBuilder with (read|write)NamedWriteable
This commit is contained in:
parent
70d55b36e1
commit
4ba8bce3fd
|
@ -739,13 +739,6 @@ public abstract class StreamInput extends InputStream {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a {@link AggregatorBuilder} from the current stream
|
||||
*/
|
||||
public AggregatorBuilder<?> readAggregatorBuilder() throws IOException {
|
||||
return readNamedWriteable(AggregatorBuilder.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a {@link PipelineAggregatorBuilder} from the current stream
|
||||
*/
|
||||
|
|
|
@ -704,13 +704,6 @@ public abstract class StreamOutput extends OutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link AggregatorBuilder} to the current stream
|
||||
*/
|
||||
public void writeAggregatorBuilder(AggregatorBuilder<?> builder) throws IOException {
|
||||
writeNamedWriteable(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a {@link PipelineAggregatorBuilder} to the current stream
|
||||
*/
|
||||
|
|
|
@ -277,13 +277,11 @@ public class AggregatorFactories {
|
|||
Builder builder = new Builder();
|
||||
int factoriesSize = in.readVInt();
|
||||
for (int i = 0; i < factoriesSize; i++) {
|
||||
AggregatorBuilder<?> factory = in.readAggregatorBuilder();
|
||||
builder.addAggregator(factory);
|
||||
builder.addAggregator(in.readNamedWriteable(AggregatorBuilder.class));
|
||||
}
|
||||
int pipelineFactoriesSize = in.readVInt();
|
||||
for (int i = 0; i < pipelineFactoriesSize; i++) {
|
||||
PipelineAggregatorBuilder<?> factory = in.readPipelineAggregatorBuilder();
|
||||
builder.addPipelineAggregator(factory);
|
||||
builder.addPipelineAggregator(in.readNamedWriteable(PipelineAggregatorBuilder.class));
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
@ -291,12 +289,12 @@ public class AggregatorFactories {
|
|||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeVInt(this.aggregatorBuilders.size());
|
||||
for (AggregatorBuilder<?> factory : aggregatorBuilders) {
|
||||
out.writeAggregatorBuilder(factory);
|
||||
for (AggregatorBuilder<?> builder : aggregatorBuilders) {
|
||||
out.writeNamedWriteable(builder);
|
||||
}
|
||||
out.writeVInt(this.pipelineAggregatorBuilders.size());
|
||||
for (PipelineAggregatorBuilder<?> factory : pipelineAggregatorBuilders) {
|
||||
out.writePipelineAggregatorBuilder(factory);
|
||||
for (PipelineAggregatorBuilder<?> builder : pipelineAggregatorBuilders) {
|
||||
out.writeNamedWriteable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -251,9 +251,9 @@ public abstract class BaseAggregationTestCase<AB extends AggregatorBuilder<AB>>
|
|||
public void testSerialization() throws IOException {
|
||||
AB testAgg = createTestAggregatorBuilder();
|
||||
try (BytesStreamOutput output = new BytesStreamOutput()) {
|
||||
output.writeAggregatorBuilder(testAgg);
|
||||
output.writeNamedWriteable(testAgg);
|
||||
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
|
||||
AggregatorBuilder deserialized = in.readAggregatorBuilder();
|
||||
AggregatorBuilder<?> deserialized = in.readNamedWriteable(AggregatorBuilder.class);
|
||||
assertEquals(testAgg, deserialized);
|
||||
assertEquals(testAgg.hashCode(), deserialized.hashCode());
|
||||
assertNotSame(testAgg, deserialized);
|
||||
|
|
Loading…
Reference in New Issue