Remove Dead Code Around Snapshots (#44109) (#44236)

* Just some random spots that have become unused with recent cleanups
This commit is contained in:
Armin Braun 2019-07-11 21:56:36 +02:00 committed by GitHub
parent 5698f4dc27
commit 0dd06cf7a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 55 deletions

View File

@ -460,9 +460,6 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
this.entries = entriesBuilder.build();
}
/**
* {@inheritDoc}
*/
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(entries.size());
@ -485,14 +482,11 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
}
}
/**
* {@inheritDoc}
*/
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startArray("snapshots");
for (ObjectCursor<Entry> entry : entries.values()) {
toXContent(entry.value, builder, params);
toXContent(entry.value, builder);
}
builder.endArray();
return builder;
@ -503,9 +497,8 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
*
* @param entry restore operation metadata
* @param builder XContent builder
* @param params serialization parameters
*/
public void toXContent(Entry entry, XContentBuilder builder, ToXContent.Params params) throws IOException {
public void toXContent(Entry entry, XContentBuilder builder) throws IOException {
builder.startObject();
builder.field("snapshot", entry.snapshot().getSnapshotId().getName());
builder.field("repository", entry.snapshot().getRepository());

View File

@ -44,10 +44,6 @@ public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> i
// the list of snapshot deletion request entries
private final List<Entry> entries;
public SnapshotDeletionsInProgress() {
this(Collections.emptyList());
}
private SnapshotDeletionsInProgress(List<Entry> entries) {
this.entries = Collections.unmodifiableList(entries);
}

View File

@ -315,24 +315,21 @@ public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implement
}
public enum State {
INIT((byte) 0, false, false),
STARTED((byte) 1, false, false),
SUCCESS((byte) 2, true, false),
FAILED((byte) 3, true, true),
ABORTED((byte) 4, false, true),
MISSING((byte) 5, true, true),
WAITING((byte) 6, false, false);
INIT((byte) 0, false),
STARTED((byte) 1, false),
SUCCESS((byte) 2, true),
FAILED((byte) 3, true),
ABORTED((byte) 4, false),
MISSING((byte) 5, true),
WAITING((byte) 6, false);
private final byte value;
private final boolean completed;
private final boolean failed;
State(byte value, boolean completed, boolean failed) {
State(byte value, boolean completed) {
this.value = value;
this.completed = completed;
this.failed = failed;
}
public byte value() {
@ -343,10 +340,6 @@ public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implement
return completed;
}
public boolean failed() {
return failed;
}
public static State fromValue(byte value) {
switch (value) {
case 0:

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import java.io.IOException;
import java.util.Objects;
@ -129,19 +128,4 @@ public final class SnapshotId implements Comparable<SnapshotId>, Writeable, ToXC
builder.endObject();
return builder;
}
public static SnapshotId fromXContent(XContentParser parser) throws IOException {
String name = null;
String uuid = null;
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
String currentFieldName = parser.currentName();
parser.nextToken();
if (NAME.equals(currentFieldName)) {
name = parser.text();
} else if (UUID.equals(currentFieldName)) {
uuid = parser.text();
}
}
return new SnapshotId(name, uuid);
}
}

View File

@ -320,17 +320,6 @@ public final class SnapshotInfo implements Comparable<SnapshotInfo>, ToXContent,
}
}
/**
* Gets a new {@link SnapshotInfo} instance for a snapshot that is incompatible with the
* current version of the cluster.
*/
public static SnapshotInfo incompatible(SnapshotId snapshotId) {
return new SnapshotInfo(snapshotId, Collections.emptyList(), SnapshotState.INCOMPATIBLE,
"the snapshot is incompatible with the current version of Elasticsearch and its exact version is unknown",
null, 0L, 0L, 0, 0,
Collections.emptyList(), null, null);
}
/**
* Gets a new {@link SnapshotInfo} instance from the given {@link SnapshotInfo} with
* all information stripped out except the snapshot id, state, and indices.