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

This commit is contained in:
Nanda kumar 2017-12-01 19:53:39 +05:30 committed by Owen O'Malley
parent 85ec48a646
commit 7bba3943f0
6 changed files with 17 additions and 15 deletions

View File

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

View File

@ -46,6 +46,16 @@ message KeyValue {
optional string value = 2; 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 * Enum that represents the Node State. This is used in calls to getNodeList
* and getNodeCount. * and getNodeCount.

View File

@ -29,7 +29,7 @@
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.fs.FileUtil; 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; import org.apache.hadoop.util.Time;
/** /**

View File

@ -28,7 +28,7 @@
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import org.apache.hadoop.classification.InterfaceAudience; 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 * Common class for storage information. This class defines the common

View File

@ -20,7 +20,7 @@
import org.apache.hadoop.conf.OzoneConfiguration; import org.apache.hadoop.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.common.Storage; 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 org.apache.hadoop.ozone.web.utils.OzoneUtils;
import java.io.IOException; import java.io.IOException;

View File

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