소스 검색

Remove Dead Code Around Snapshots (#44109)

* Just some random spots that have become unused with recent cleanups
Armin Braun 6 년 전
부모
커밋
c39fd45a74

+ 2 - 9
server/src/main/java/org/elasticsearch/cluster/RestoreInProgress.java

@@ -449,9 +449,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());
@@ -472,14 +469,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;
@@ -490,9 +484,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());

+ 0 - 4
server/src/main/java/org/elasticsearch/cluster/SnapshotDeletionsInProgress.java

@@ -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);
     }

+ 8 - 15
server/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java

@@ -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:

+ 0 - 16
server/src/main/java/org/elasticsearch/snapshots/SnapshotId.java

@@ -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);
-    }
 }

+ 0 - 11
server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java

@@ -316,17 +316,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.