Fixes compile errors from TimeValue serialisation

This commit is contained in:
Colin Goodheart-Smithe 2018-04-12 12:15:36 +01:00
parent 20b6aaf6b6
commit 7b247fe41e
2 changed files with 4 additions and 12 deletions

View File

@ -82,7 +82,7 @@ public class Phase implements ToXContentObject, Writeable {
*/
public Phase(StreamInput in) throws IOException {
this.name = in.readString();
this.after = new TimeValue(in);
this.after = in.readTimeValue();
int size = in.readVInt();
TreeMap<String, LifecycleAction> actions = new TreeMap<>();
for (int i = 0; i < size; i++) {
@ -94,7 +94,7 @@ public class Phase implements ToXContentObject, Writeable {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
after.writeTo(out);
out.writeTimeValue(after);
out.writeVInt(actions.size());
for (Map.Entry<String, LifecycleAction> entry : actions.entrySet()) {
out.writeString(entry.getKey());

View File

@ -73,11 +73,7 @@ public class RolloverAction implements LifecycleAction {
} else {
maxSize = null;
}
if (in.readBoolean()) {
maxAge = new TimeValue(in);
} else {
maxAge = null;
}
maxAge = in.readOptionalTimeValue();
if (in.readBoolean()) {
maxDocs = in.readVLong();
} else {
@ -93,11 +89,7 @@ public class RolloverAction implements LifecycleAction {
if (hasMaxSize) {
maxSize.writeTo(out);
}
boolean hasMaxAge = maxAge != null;
out.writeBoolean(hasMaxAge);
if (hasMaxAge) {
maxAge.writeTo(out);
}
out.writeOptionalTimeValue(maxAge);
boolean hasMaxDocs = maxDocs != null;
out.writeBoolean(hasMaxDocs);
if (hasMaxDocs) {