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 final class OzoneConsts {
public static final int INVALID_PORT = -1;
/**
* Type of the node.
*/
public enum NodeType {
KSM,
SCM,
DATANODE
}
private OzoneConsts() {
// Never Constructed
}

View File

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

View File

@ -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;
/**

View File

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

View File

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

View File

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