|
@@ -86,7 +86,7 @@ public class DatanodeInfo extends DatanodeID implements Node {
|
|
|
protected AdminStates adminState;
|
|
|
private long maintenanceExpireTimeInMS;
|
|
|
|
|
|
- public DatanodeInfo(DatanodeInfo from) {
|
|
|
+ protected DatanodeInfo(DatanodeInfo from) {
|
|
|
super(from);
|
|
|
this.capacity = from.getCapacity();
|
|
|
this.dfsUsed = from.getDfsUsed();
|
|
@@ -103,7 +103,7 @@ public class DatanodeInfo extends DatanodeID implements Node {
|
|
|
this.upgradeDomain = from.getUpgradeDomain();
|
|
|
}
|
|
|
|
|
|
- public DatanodeInfo(DatanodeID nodeID) {
|
|
|
+ protected DatanodeInfo(DatanodeID nodeID) {
|
|
|
super(nodeID);
|
|
|
this.capacity = 0L;
|
|
|
this.dfsUsed = 0L;
|
|
@@ -118,57 +118,13 @@ public class DatanodeInfo extends DatanodeID implements Node {
|
|
|
this.adminState = null;
|
|
|
}
|
|
|
|
|
|
- public DatanodeInfo(DatanodeID nodeID, String location) {
|
|
|
+ protected DatanodeInfo(DatanodeID nodeID, String location) {
|
|
|
this(nodeID);
|
|
|
this.location = location;
|
|
|
}
|
|
|
|
|
|
- public DatanodeInfo(DatanodeID nodeID, String location,
|
|
|
- final long capacity, final long dfsUsed, final long remaining,
|
|
|
- final long blockPoolUsed, final long cacheCapacity, final long cacheUsed,
|
|
|
- final long lastUpdate, final long lastUpdateMonotonic,
|
|
|
- final int xceiverCount, final AdminStates adminState,
|
|
|
- final String upgradeDomain) {
|
|
|
- this(nodeID.getIpAddr(), nodeID.getHostName(), nodeID.getDatanodeUuid(),
|
|
|
- nodeID.getXferPort(), nodeID.getInfoPort(), nodeID.getInfoSecurePort(),
|
|
|
- nodeID.getIpcPort(), capacity, dfsUsed, remaining, blockPoolUsed,
|
|
|
- cacheCapacity, cacheUsed, lastUpdate, lastUpdateMonotonic,
|
|
|
- xceiverCount, location, adminState, upgradeDomain);
|
|
|
- }
|
|
|
-
|
|
|
- /** Constructor */
|
|
|
- public DatanodeInfo(final String ipAddr, final String hostName,
|
|
|
- final String datanodeUuid, final int xferPort, final int infoPort,
|
|
|
- final int infoSecurePort, final int ipcPort,
|
|
|
- final long capacity, final long dfsUsed, final long remaining,
|
|
|
- final long blockPoolUsed, final long cacheCapacity, final long cacheUsed,
|
|
|
- final long lastUpdate, final long lastUpdateMonotonic,
|
|
|
- final int xceiverCount, final String networkLocation,
|
|
|
- final AdminStates adminState) {
|
|
|
- this(ipAddr, hostName, datanodeUuid, xferPort, infoPort, infoSecurePort,
|
|
|
- ipcPort, capacity, dfsUsed, remaining, blockPoolUsed, cacheCapacity,
|
|
|
- cacheUsed, lastUpdate, lastUpdateMonotonic, xceiverCount,
|
|
|
- networkLocation, adminState, null);
|
|
|
- }
|
|
|
-
|
|
|
- /** Constructor */
|
|
|
- public DatanodeInfo(final String ipAddr, final String hostName,
|
|
|
- final String datanodeUuid, final int xferPort, final int infoPort,
|
|
|
- final int infoSecurePort, final int ipcPort,
|
|
|
- final long capacity, final long dfsUsed, final long remaining,
|
|
|
- final long blockPoolUsed, final long cacheCapacity, final long cacheUsed,
|
|
|
- final long lastUpdate, final long lastUpdateMonotonic,
|
|
|
- final int xceiverCount, final String networkLocation,
|
|
|
- final AdminStates adminState,
|
|
|
- final String upgradeDomain) {
|
|
|
- this(ipAddr, hostName, datanodeUuid, xferPort, infoPort, infoSecurePort,
|
|
|
- ipcPort, capacity, dfsUsed, 0L, remaining, blockPoolUsed,
|
|
|
- cacheCapacity, cacheUsed, lastUpdate, lastUpdateMonotonic,
|
|
|
- xceiverCount, networkLocation, adminState, upgradeDomain);
|
|
|
- }
|
|
|
-
|
|
|
/** Constructor. */
|
|
|
- public DatanodeInfo(final String ipAddr, final String hostName,
|
|
|
+ private DatanodeInfo(final String ipAddr, final String hostName,
|
|
|
final String datanodeUuid, final int xferPort, final int infoPort,
|
|
|
final int infoSecurePort, final int ipcPort, final long capacity,
|
|
|
final long dfsUsed, final long nonDfsUsed, final long remaining,
|
|
@@ -662,4 +618,169 @@ public class DatanodeInfo extends DatanodeID implements Node {
|
|
|
public void setSoftwareVersion(String softwareVersion) {
|
|
|
this.softwareVersion = softwareVersion;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Building the DataNodeInfo.
|
|
|
+ */
|
|
|
+ public static class DatanodeInfoBuilder {
|
|
|
+ private String location = NetworkTopology.DEFAULT_RACK;
|
|
|
+ private long capacity;
|
|
|
+ private long dfsUsed;
|
|
|
+ private long remaining;
|
|
|
+ private long blockPoolUsed;
|
|
|
+ private long cacheCapacity;
|
|
|
+ private long cacheUsed;
|
|
|
+ private long lastUpdate;
|
|
|
+ private long lastUpdateMonotonic;
|
|
|
+ private int xceiverCount;
|
|
|
+ private DatanodeInfo.AdminStates adminState;
|
|
|
+ private String upgradeDomain;
|
|
|
+ private String ipAddr;
|
|
|
+ private String hostName;
|
|
|
+ private String datanodeUuid;
|
|
|
+ private int xferPort;
|
|
|
+ private int infoPort;
|
|
|
+ private int infoSecurePort;
|
|
|
+ private int ipcPort;
|
|
|
+ private long nonDfsUsed = 0L;
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setFrom(DatanodeInfo from) {
|
|
|
+ this.capacity = from.getCapacity();
|
|
|
+ this.dfsUsed = from.getDfsUsed();
|
|
|
+ this.nonDfsUsed = from.getNonDfsUsed();
|
|
|
+ this.remaining = from.getRemaining();
|
|
|
+ this.blockPoolUsed = from.getBlockPoolUsed();
|
|
|
+ this.cacheCapacity = from.getCacheCapacity();
|
|
|
+ this.cacheUsed = from.getCacheUsed();
|
|
|
+ this.lastUpdate = from.getLastUpdate();
|
|
|
+ this.lastUpdateMonotonic = from.getLastUpdateMonotonic();
|
|
|
+ this.xceiverCount = from.getXceiverCount();
|
|
|
+ this.location = from.getNetworkLocation();
|
|
|
+ this.adminState = from.getAdminState();
|
|
|
+ this.upgradeDomain = from.getUpgradeDomain();
|
|
|
+ setNodeID(from);
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setNodeID(DatanodeID nodeID) {
|
|
|
+ this.ipAddr = nodeID.getIpAddr();
|
|
|
+ this.hostName = nodeID.getHostName();
|
|
|
+ this.datanodeUuid = nodeID.getDatanodeUuid();
|
|
|
+ this.xferPort = nodeID.getXferPort();
|
|
|
+ this.infoPort = nodeID.getInfoPort();
|
|
|
+ this.infoSecurePort = nodeID.getInfoSecurePort();
|
|
|
+ this.ipcPort = nodeID.getIpcPort();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setCapacity(long capacity) {
|
|
|
+ this.capacity = capacity;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setDfsUsed(long dfsUsed) {
|
|
|
+ this.dfsUsed = dfsUsed;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setRemaining(long remaining) {
|
|
|
+ this.remaining = remaining;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setBlockPoolUsed(long blockPoolUsed) {
|
|
|
+ this.blockPoolUsed = blockPoolUsed;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setCacheCapacity(long cacheCapacity) {
|
|
|
+ this.cacheCapacity = cacheCapacity;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setCacheUsed(long cacheUsed) {
|
|
|
+ this.cacheUsed = cacheUsed;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setLastUpdate(long lastUpdate) {
|
|
|
+ this.lastUpdate = lastUpdate;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setLastUpdateMonotonic(
|
|
|
+ long lastUpdateMonotonic) {
|
|
|
+ this.lastUpdateMonotonic = lastUpdateMonotonic;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setXceiverCount(int xceiverCount) {
|
|
|
+ this.xceiverCount = xceiverCount;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setAdminState(
|
|
|
+ DatanodeInfo.AdminStates adminState) {
|
|
|
+ this.adminState = adminState;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setUpgradeDomain(String upgradeDomain) {
|
|
|
+ this.upgradeDomain = upgradeDomain;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setIpAddr(String ipAddr) {
|
|
|
+ this.ipAddr = ipAddr;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setHostName(String hostName) {
|
|
|
+ this.hostName = hostName;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setDatanodeUuid(String datanodeUuid) {
|
|
|
+ this.datanodeUuid = datanodeUuid;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setXferPort(int xferPort) {
|
|
|
+ this.xferPort = xferPort;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setInfoPort(int infoPort) {
|
|
|
+ this.infoPort = infoPort;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setInfoSecurePort(int infoSecurePort) {
|
|
|
+ this.infoSecurePort = infoSecurePort;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setIpcPort(int ipcPort) {
|
|
|
+ this.ipcPort = ipcPort;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setNetworkLocation(String networkLocation) {
|
|
|
+ this.location = networkLocation;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfoBuilder setNonDfsUsed(long nonDfsUsed) {
|
|
|
+ this.nonDfsUsed = nonDfsUsed;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DatanodeInfo build() {
|
|
|
+ return new DatanodeInfo(ipAddr, hostName, datanodeUuid, xferPort,
|
|
|
+ infoPort, infoSecurePort, ipcPort, capacity, dfsUsed, nonDfsUsed,
|
|
|
+ remaining, blockPoolUsed, cacheCapacity, cacheUsed, lastUpdate,
|
|
|
+ lastUpdateMonotonic, xceiverCount, location, adminState,
|
|
|
+ upgradeDomain);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|