소스 검색

HDFS-12876. Ozone: moving NodeType from OzoneConsts to Ozone.proto. Contributed by Nanda kumar.

Nanda kumar 7 년 전
부모
커밋
8f7f4aa800

+ 0 - 9
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java

@@ -147,15 +147,6 @@ public final class OzoneConsts {
 
   public static final int INVALID_PORT = -1;
 
-  /**
-   * Type of the node.
-   */
-  public enum NodeType {
-    KSM,
-    SCM,
-    DATANODE
-  }
-
   private OzoneConsts() {
     // Never Constructed
   }

+ 10 - 0
hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/Ozone.proto

@@ -46,6 +46,16 @@ message KeyValue {
     optional string value = 2;
 }
 
+/**
+ * Type of the node.
+ */
+enum NodeType {
+    KSM = 1;
+    SCM = 2;
+    DATANODE = 3;
+}
+
+// Should we rename NodeState to DatanodeState?
 /**
  * Enum that represents the Node State. This is used in calls to getNodeList
  * and getNodeCount.

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/common/Storage.java

@@ -29,7 +29,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.ozone.OzoneConsts.NodeType;
+import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.NodeType;
 import org.apache.hadoop.util.Time;
 
 /**

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/common/StorageInfo.java

@@ -28,7 +28,7 @@ import java.util.UUID;
 
 import com.google.common.base.Preconditions;
 import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.ozone.OzoneConsts.NodeType;
+import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.NodeType;
 
 /**
  * Common class for storage information. This class defines the common

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/SCMStorage.java

@@ -20,7 +20,7 @@ package org.apache.hadoop.ozone.scm;
 
 import org.apache.hadoop.conf.OzoneConfiguration;
 import org.apache.hadoop.ozone.common.Storage;
-import org.apache.hadoop.ozone.OzoneConsts.NodeType;
+import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.NodeType;
 import org.apache.hadoop.ozone.web.utils.OzoneUtils;
 
 import java.io.IOException;

+ 4 - 3
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java

@@ -25,6 +25,7 @@ import org.apache.hadoop.conf.OzoneConfiguration;
 import org.apache.hadoop.ozone.protocol.commands.DeleteBlocksCommand;
 import org.apache.hadoop.ozone.protocol.commands.SCMCommand;
 import org.apache.hadoop.ozone.protocol.proto.OzoneProtos;
+import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.NodeType;
 import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.NodeState;
 import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction;
 import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ReportState;
@@ -371,11 +372,11 @@ public class TestStorageContainerManager {
     StorageContainerManager.scmInit(conf);
 
     SCMStorage scmStore = new SCMStorage(conf);
-    Assert.assertEquals(OzoneConsts.NodeType.SCM, scmStore.getNodeType());
+    Assert.assertEquals(NodeType.SCM, scmStore.getNodeType());
     Assert.assertEquals("testClusterId", scmStore.getClusterID());
     StartupOption.INIT.setClusterId("testClusterIdNew");
     StorageContainerManager.scmInit(conf);
-    Assert.assertEquals(OzoneConsts.NodeType.SCM, scmStore.getNodeType());
+    Assert.assertEquals(NodeType.SCM, scmStore.getNodeType());
     Assert.assertEquals("testClusterId", scmStore.getClusterID());
 
   }
@@ -395,7 +396,7 @@ public class TestStorageContainerManager {
     // This will initialize SCM
     StorageContainerManager.scmInit(conf);
     SCMStorage scmStore = new SCMStorage(conf);
-    Assert.assertEquals(OzoneConsts.NodeType.SCM, scmStore.getNodeType());
+    Assert.assertEquals(NodeType.SCM, scmStore.getNodeType());
     Assert.assertNotEquals("testClusterId", scmStore.getClusterID());
   }