/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package org.apache.hadoop.thriftfs.api; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Information and state of a data node. * * Modelled after org.apache.hadoop.hdfs.protocol.DatanodeInfo */ public class DatanodeInfo implements org.apache.thrift.TBase<DatanodeInfo, DatanodeInfo._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DatanodeInfo"); private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField STORAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("storageID", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)3); private static final org.apache.thrift.protocol.TField THRIFT_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("thriftPort", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField HTTP_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("httpPort", org.apache.thrift.protocol.TType.I32, (short)10); private static final org.apache.thrift.protocol.TField CAPACITY_FIELD_DESC = new org.apache.thrift.protocol.TField("capacity", org.apache.thrift.protocol.TType.I64, (short)5); private static final org.apache.thrift.protocol.TField DFS_USED_FIELD_DESC = new org.apache.thrift.protocol.TField("dfsUsed", org.apache.thrift.protocol.TType.I64, (short)6); private static final org.apache.thrift.protocol.TField REMAINING_FIELD_DESC = new org.apache.thrift.protocol.TField("remaining", org.apache.thrift.protocol.TType.I64, (short)7); private static final org.apache.thrift.protocol.TField XCEIVER_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("xceiverCount", org.apache.thrift.protocol.TType.I32, (short)8); private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)9); private static final org.apache.thrift.protocol.TField MILLIS_SINCE_UPDATE_FIELD_DESC = new org.apache.thrift.protocol.TField("millisSinceUpdate", org.apache.thrift.protocol.TType.I64, (short)11); /** * HDFS name of the datanode (equals to <host>:<datanode port>) */ public String name; /** * Unique ID within a HDFS cluster */ public String storageID; /** * Host name of the Thrift server socket. */ public String host; /** * Port number of the Thrift server socket, or UNKNOWN_THRIFT_PORT * if the Thrift port for this datanode is not known. */ public int thriftPort; /** * Port number of the Web UI */ public int httpPort; /** * Raw capacity of the data node (in bytes). */ public long capacity; /** * Space used by the data node (in bytes). */ public long dfsUsed; /** * Raw free space in the data node (in bytes). */ public long remaining; /** * Number of active connections to the data node. */ public int xceiverCount; /** * State of this data node. * * @see DatanodeState */ public DatanodeState state; /** * Number of seconds since last contact */ public long millisSinceUpdate; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { /** * HDFS name of the datanode (equals to <host>:<datanode port>) */ NAME((short)1, "name"), /** * Unique ID within a HDFS cluster */ STORAGE_ID((short)2, "storageID"), /** * Host name of the Thrift server socket. */ HOST((short)3, "host"), /** * Port number of the Thrift server socket, or UNKNOWN_THRIFT_PORT * if the Thrift port for this datanode is not known. */ THRIFT_PORT((short)4, "thriftPort"), /** * Port number of the Web UI */ HTTP_PORT((short)10, "httpPort"), /** * Raw capacity of the data node (in bytes). */ CAPACITY((short)5, "capacity"), /** * Space used by the data node (in bytes). */ DFS_USED((short)6, "dfsUsed"), /** * Raw free space in the data node (in bytes). */ REMAINING((short)7, "remaining"), /** * Number of active connections to the data node. */ XCEIVER_COUNT((short)8, "xceiverCount"), /** * State of this data node. * * @see DatanodeState */ STATE((short)9, "state"), /** * Number of seconds since last contact */ MILLIS_SINCE_UPDATE((short)11, "millisSinceUpdate"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // NAME return NAME; case 2: // STORAGE_ID return STORAGE_ID; case 3: // HOST return HOST; case 4: // THRIFT_PORT return THRIFT_PORT; case 10: // HTTP_PORT return HTTP_PORT; case 5: // CAPACITY return CAPACITY; case 6: // DFS_USED return DFS_USED; case 7: // REMAINING return REMAINING; case 8: // XCEIVER_COUNT return XCEIVER_COUNT; case 9: // STATE return STATE; case 11: // MILLIS_SINCE_UPDATE return MILLIS_SINCE_UPDATE; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __THRIFTPORT_ISSET_ID = 0; private static final int __HTTPPORT_ISSET_ID = 1; private static final int __CAPACITY_ISSET_ID = 2; private static final int __DFSUSED_ISSET_ID = 3; private static final int __REMAINING_ISSET_ID = 4; private static final int __XCEIVERCOUNT_ISSET_ID = 5; private static final int __MILLISSINCEUPDATE_ISSET_ID = 6; private BitSet __isset_bit_vector = new BitSet(7); public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.STORAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("storageID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.THRIFT_PORT, new org.apache.thrift.meta_data.FieldMetaData("thriftPort", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.HTTP_PORT, new org.apache.thrift.meta_data.FieldMetaData("httpPort", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.CAPACITY, new org.apache.thrift.meta_data.FieldMetaData("capacity", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.DFS_USED, new org.apache.thrift.meta_data.FieldMetaData("dfsUsed", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.REMAINING, new org.apache.thrift.meta_data.FieldMetaData("remaining", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.XCEIVER_COUNT, new org.apache.thrift.meta_data.FieldMetaData("xceiverCount", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DatanodeState.class))); tmpMap.put(_Fields.MILLIS_SINCE_UPDATE, new org.apache.thrift.meta_data.FieldMetaData("millisSinceUpdate", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DatanodeInfo.class, metaDataMap); } public DatanodeInfo() { } public DatanodeInfo( String name, String storageID, String host, int thriftPort, int httpPort, long capacity, long dfsUsed, long remaining, int xceiverCount, DatanodeState state, long millisSinceUpdate) { this(); this.name = name; this.storageID = storageID; this.host = host; this.thriftPort = thriftPort; setThriftPortIsSet(true); this.httpPort = httpPort; setHttpPortIsSet(true); this.capacity = capacity; setCapacityIsSet(true); this.dfsUsed = dfsUsed; setDfsUsedIsSet(true); this.remaining = remaining; setRemainingIsSet(true); this.xceiverCount = xceiverCount; setXceiverCountIsSet(true); this.state = state; this.millisSinceUpdate = millisSinceUpdate; setMillisSinceUpdateIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public DatanodeInfo(DatanodeInfo other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetName()) { this.name = other.name; } if (other.isSetStorageID()) { this.storageID = other.storageID; } if (other.isSetHost()) { this.host = other.host; } this.thriftPort = other.thriftPort; this.httpPort = other.httpPort; this.capacity = other.capacity; this.dfsUsed = other.dfsUsed; this.remaining = other.remaining; this.xceiverCount = other.xceiverCount; if (other.isSetState()) { this.state = other.state; } this.millisSinceUpdate = other.millisSinceUpdate; } public DatanodeInfo deepCopy() { return new DatanodeInfo(this); } @Override public void clear() { this.name = null; this.storageID = null; this.host = null; setThriftPortIsSet(false); this.thriftPort = 0; setHttpPortIsSet(false); this.httpPort = 0; setCapacityIsSet(false); this.capacity = 0; setDfsUsedIsSet(false); this.dfsUsed = 0; setRemainingIsSet(false); this.remaining = 0; setXceiverCountIsSet(false); this.xceiverCount = 0; this.state = null; setMillisSinceUpdateIsSet(false); this.millisSinceUpdate = 0; } /** * HDFS name of the datanode (equals to <host>:<datanode port>) */ public String getName() { return this.name; } /** * HDFS name of the datanode (equals to <host>:<datanode port>) */ public DatanodeInfo setName(String name) { this.name = name; return this; } public void unsetName() { this.name = null; } /** Returns true if field name is set (has been assigned a value) and false otherwise */ public boolean isSetName() { return this.name != null; } public void setNameIsSet(boolean value) { if (!value) { this.name = null; } } /** * Unique ID within a HDFS cluster */ public String getStorageID() { return this.storageID; } /** * Unique ID within a HDFS cluster */ public DatanodeInfo setStorageID(String storageID) { this.storageID = storageID; return this; } public void unsetStorageID() { this.storageID = null; } /** Returns true if field storageID is set (has been assigned a value) and false otherwise */ public boolean isSetStorageID() { return this.storageID != null; } public void setStorageIDIsSet(boolean value) { if (!value) { this.storageID = null; } } /** * Host name of the Thrift server socket. */ public String getHost() { return this.host; } /** * Host name of the Thrift server socket. */ public DatanodeInfo setHost(String host) { this.host = host; return this; } public void unsetHost() { this.host = null; } /** Returns true if field host is set (has been assigned a value) and false otherwise */ public boolean isSetHost() { return this.host != null; } public void setHostIsSet(boolean value) { if (!value) { this.host = null; } } /** * Port number of the Thrift server socket, or UNKNOWN_THRIFT_PORT * if the Thrift port for this datanode is not known. */ public int getThriftPort() { return this.thriftPort; } /** * Port number of the Thrift server socket, or UNKNOWN_THRIFT_PORT * if the Thrift port for this datanode is not known. */ public DatanodeInfo setThriftPort(int thriftPort) { this.thriftPort = thriftPort; setThriftPortIsSet(true); return this; } public void unsetThriftPort() { __isset_bit_vector.clear(__THRIFTPORT_ISSET_ID); } /** Returns true if field thriftPort is set (has been assigned a value) and false otherwise */ public boolean isSetThriftPort() { return __isset_bit_vector.get(__THRIFTPORT_ISSET_ID); } public void setThriftPortIsSet(boolean value) { __isset_bit_vector.set(__THRIFTPORT_ISSET_ID, value); } /** * Port number of the Web UI */ public int getHttpPort() { return this.httpPort; } /** * Port number of the Web UI */ public DatanodeInfo setHttpPort(int httpPort) { this.httpPort = httpPort; setHttpPortIsSet(true); return this; } public void unsetHttpPort() { __isset_bit_vector.clear(__HTTPPORT_ISSET_ID); } /** Returns true if field httpPort is set (has been assigned a value) and false otherwise */ public boolean isSetHttpPort() { return __isset_bit_vector.get(__HTTPPORT_ISSET_ID); } public void setHttpPortIsSet(boolean value) { __isset_bit_vector.set(__HTTPPORT_ISSET_ID, value); } /** * Raw capacity of the data node (in bytes). */ public long getCapacity() { return this.capacity; } /** * Raw capacity of the data node (in bytes). */ public DatanodeInfo setCapacity(long capacity) { this.capacity = capacity; setCapacityIsSet(true); return this; } public void unsetCapacity() { __isset_bit_vector.clear(__CAPACITY_ISSET_ID); } /** Returns true if field capacity is set (has been assigned a value) and false otherwise */ public boolean isSetCapacity() { return __isset_bit_vector.get(__CAPACITY_ISSET_ID); } public void setCapacityIsSet(boolean value) { __isset_bit_vector.set(__CAPACITY_ISSET_ID, value); } /** * Space used by the data node (in bytes). */ public long getDfsUsed() { return this.dfsUsed; } /** * Space used by the data node (in bytes). */ public DatanodeInfo setDfsUsed(long dfsUsed) { this.dfsUsed = dfsUsed; setDfsUsedIsSet(true); return this; } public void unsetDfsUsed() { __isset_bit_vector.clear(__DFSUSED_ISSET_ID); } /** Returns true if field dfsUsed is set (has been assigned a value) and false otherwise */ public boolean isSetDfsUsed() { return __isset_bit_vector.get(__DFSUSED_ISSET_ID); } public void setDfsUsedIsSet(boolean value) { __isset_bit_vector.set(__DFSUSED_ISSET_ID, value); } /** * Raw free space in the data node (in bytes). */ public long getRemaining() { return this.remaining; } /** * Raw free space in the data node (in bytes). */ public DatanodeInfo setRemaining(long remaining) { this.remaining = remaining; setRemainingIsSet(true); return this; } public void unsetRemaining() { __isset_bit_vector.clear(__REMAINING_ISSET_ID); } /** Returns true if field remaining is set (has been assigned a value) and false otherwise */ public boolean isSetRemaining() { return __isset_bit_vector.get(__REMAINING_ISSET_ID); } public void setRemainingIsSet(boolean value) { __isset_bit_vector.set(__REMAINING_ISSET_ID, value); } /** * Number of active connections to the data node. */ public int getXceiverCount() { return this.xceiverCount; } /** * Number of active connections to the data node. */ public DatanodeInfo setXceiverCount(int xceiverCount) { this.xceiverCount = xceiverCount; setXceiverCountIsSet(true); return this; } public void unsetXceiverCount() { __isset_bit_vector.clear(__XCEIVERCOUNT_ISSET_ID); } /** Returns true if field xceiverCount is set (has been assigned a value) and false otherwise */ public boolean isSetXceiverCount() { return __isset_bit_vector.get(__XCEIVERCOUNT_ISSET_ID); } public void setXceiverCountIsSet(boolean value) { __isset_bit_vector.set(__XCEIVERCOUNT_ISSET_ID, value); } /** * State of this data node. * * @see DatanodeState */ public DatanodeState getState() { return this.state; } /** * State of this data node. * * @see DatanodeState */ public DatanodeInfo setState(DatanodeState state) { this.state = state; return this; } public void unsetState() { this.state = null; } /** Returns true if field state is set (has been assigned a value) and false otherwise */ public boolean isSetState() { return this.state != null; } public void setStateIsSet(boolean value) { if (!value) { this.state = null; } } /** * Number of seconds since last contact */ public long getMillisSinceUpdate() { return this.millisSinceUpdate; } /** * Number of seconds since last contact */ public DatanodeInfo setMillisSinceUpdate(long millisSinceUpdate) { this.millisSinceUpdate = millisSinceUpdate; setMillisSinceUpdateIsSet(true); return this; } public void unsetMillisSinceUpdate() { __isset_bit_vector.clear(__MILLISSINCEUPDATE_ISSET_ID); } /** Returns true if field millisSinceUpdate is set (has been assigned a value) and false otherwise */ public boolean isSetMillisSinceUpdate() { return __isset_bit_vector.get(__MILLISSINCEUPDATE_ISSET_ID); } public void setMillisSinceUpdateIsSet(boolean value) { __isset_bit_vector.set(__MILLISSINCEUPDATE_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case NAME: if (value == null) { unsetName(); } else { setName((String)value); } break; case STORAGE_ID: if (value == null) { unsetStorageID(); } else { setStorageID((String)value); } break; case HOST: if (value == null) { unsetHost(); } else { setHost((String)value); } break; case THRIFT_PORT: if (value == null) { unsetThriftPort(); } else { setThriftPort((Integer)value); } break; case HTTP_PORT: if (value == null) { unsetHttpPort(); } else { setHttpPort((Integer)value); } break; case CAPACITY: if (value == null) { unsetCapacity(); } else { setCapacity((Long)value); } break; case DFS_USED: if (value == null) { unsetDfsUsed(); } else { setDfsUsed((Long)value); } break; case REMAINING: if (value == null) { unsetRemaining(); } else { setRemaining((Long)value); } break; case XCEIVER_COUNT: if (value == null) { unsetXceiverCount(); } else { setXceiverCount((Integer)value); } break; case STATE: if (value == null) { unsetState(); } else { setState((DatanodeState)value); } break; case MILLIS_SINCE_UPDATE: if (value == null) { unsetMillisSinceUpdate(); } else { setMillisSinceUpdate((Long)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case NAME: return getName(); case STORAGE_ID: return getStorageID(); case HOST: return getHost(); case THRIFT_PORT: return new Integer(getThriftPort()); case HTTP_PORT: return new Integer(getHttpPort()); case CAPACITY: return new Long(getCapacity()); case DFS_USED: return new Long(getDfsUsed()); case REMAINING: return new Long(getRemaining()); case XCEIVER_COUNT: return new Integer(getXceiverCount()); case STATE: return getState(); case MILLIS_SINCE_UPDATE: return new Long(getMillisSinceUpdate()); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case NAME: return isSetName(); case STORAGE_ID: return isSetStorageID(); case HOST: return isSetHost(); case THRIFT_PORT: return isSetThriftPort(); case HTTP_PORT: return isSetHttpPort(); case CAPACITY: return isSetCapacity(); case DFS_USED: return isSetDfsUsed(); case REMAINING: return isSetRemaining(); case XCEIVER_COUNT: return isSetXceiverCount(); case STATE: return isSetState(); case MILLIS_SINCE_UPDATE: return isSetMillisSinceUpdate(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof DatanodeInfo) return this.equals((DatanodeInfo)that); return false; } public boolean equals(DatanodeInfo that) { if (that == null) return false; boolean this_present_name = true && this.isSetName(); boolean that_present_name = true && that.isSetName(); if (this_present_name || that_present_name) { if (!(this_present_name && that_present_name)) return false; if (!this.name.equals(that.name)) return false; } boolean this_present_storageID = true && this.isSetStorageID(); boolean that_present_storageID = true && that.isSetStorageID(); if (this_present_storageID || that_present_storageID) { if (!(this_present_storageID && that_present_storageID)) return false; if (!this.storageID.equals(that.storageID)) return false; } boolean this_present_host = true && this.isSetHost(); boolean that_present_host = true && that.isSetHost(); if (this_present_host || that_present_host) { if (!(this_present_host && that_present_host)) return false; if (!this.host.equals(that.host)) return false; } boolean this_present_thriftPort = true; boolean that_present_thriftPort = true; if (this_present_thriftPort || that_present_thriftPort) { if (!(this_present_thriftPort && that_present_thriftPort)) return false; if (this.thriftPort != that.thriftPort) return false; } boolean this_present_httpPort = true; boolean that_present_httpPort = true; if (this_present_httpPort || that_present_httpPort) { if (!(this_present_httpPort && that_present_httpPort)) return false; if (this.httpPort != that.httpPort) return false; } boolean this_present_capacity = true; boolean that_present_capacity = true; if (this_present_capacity || that_present_capacity) { if (!(this_present_capacity && that_present_capacity)) return false; if (this.capacity != that.capacity) return false; } boolean this_present_dfsUsed = true; boolean that_present_dfsUsed = true; if (this_present_dfsUsed || that_present_dfsUsed) { if (!(this_present_dfsUsed && that_present_dfsUsed)) return false; if (this.dfsUsed != that.dfsUsed) return false; } boolean this_present_remaining = true; boolean that_present_remaining = true; if (this_present_remaining || that_present_remaining) { if (!(this_present_remaining && that_present_remaining)) return false; if (this.remaining != that.remaining) return false; } boolean this_present_xceiverCount = true; boolean that_present_xceiverCount = true; if (this_present_xceiverCount || that_present_xceiverCount) { if (!(this_present_xceiverCount && that_present_xceiverCount)) return false; if (this.xceiverCount != that.xceiverCount) return false; } boolean this_present_state = true && this.isSetState(); boolean that_present_state = true && that.isSetState(); if (this_present_state || that_present_state) { if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false; } boolean this_present_millisSinceUpdate = true; boolean that_present_millisSinceUpdate = true; if (this_present_millisSinceUpdate || that_present_millisSinceUpdate) { if (!(this_present_millisSinceUpdate && that_present_millisSinceUpdate)) return false; if (this.millisSinceUpdate != that.millisSinceUpdate) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_name = true && (isSetName()); builder.append(present_name); if (present_name) builder.append(name); boolean present_storageID = true && (isSetStorageID()); builder.append(present_storageID); if (present_storageID) builder.append(storageID); boolean present_host = true && (isSetHost()); builder.append(present_host); if (present_host) builder.append(host); boolean present_thriftPort = true; builder.append(present_thriftPort); if (present_thriftPort) builder.append(thriftPort); boolean present_httpPort = true; builder.append(present_httpPort); if (present_httpPort) builder.append(httpPort); boolean present_capacity = true; builder.append(present_capacity); if (present_capacity) builder.append(capacity); boolean present_dfsUsed = true; builder.append(present_dfsUsed); if (present_dfsUsed) builder.append(dfsUsed); boolean present_remaining = true; builder.append(present_remaining); if (present_remaining) builder.append(remaining); boolean present_xceiverCount = true; builder.append(present_xceiverCount); if (present_xceiverCount) builder.append(xceiverCount); boolean present_state = true && (isSetState()); builder.append(present_state); if (present_state) builder.append(state.getValue()); boolean present_millisSinceUpdate = true; builder.append(present_millisSinceUpdate); if (present_millisSinceUpdate) builder.append(millisSinceUpdate); return builder.toHashCode(); } public int compareTo(DatanodeInfo other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; DatanodeInfo typedOther = (DatanodeInfo)other; lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); if (lastComparison != 0) { return lastComparison; } if (isSetName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetStorageID()).compareTo(typedOther.isSetStorageID()); if (lastComparison != 0) { return lastComparison; } if (isSetStorageID()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storageID, typedOther.storageID); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetHost()).compareTo(typedOther.isSetHost()); if (lastComparison != 0) { return lastComparison; } if (isSetHost()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, typedOther.host); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetThriftPort()).compareTo(typedOther.isSetThriftPort()); if (lastComparison != 0) { return lastComparison; } if (isSetThriftPort()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.thriftPort, typedOther.thriftPort); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetHttpPort()).compareTo(typedOther.isSetHttpPort()); if (lastComparison != 0) { return lastComparison; } if (isSetHttpPort()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.httpPort, typedOther.httpPort); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCapacity()).compareTo(typedOther.isSetCapacity()); if (lastComparison != 0) { return lastComparison; } if (isSetCapacity()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.capacity, typedOther.capacity); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetDfsUsed()).compareTo(typedOther.isSetDfsUsed()); if (lastComparison != 0) { return lastComparison; } if (isSetDfsUsed()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dfsUsed, typedOther.dfsUsed); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetRemaining()).compareTo(typedOther.isSetRemaining()); if (lastComparison != 0) { return lastComparison; } if (isSetRemaining()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.remaining, typedOther.remaining); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetXceiverCount()).compareTo(typedOther.isSetXceiverCount()); if (lastComparison != 0) { return lastComparison; } if (isSetXceiverCount()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.xceiverCount, typedOther.xceiverCount); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetState()).compareTo(typedOther.isSetState()); if (lastComparison != 0) { return lastComparison; } if (isSetState()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, typedOther.state); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetMillisSinceUpdate()).compareTo(typedOther.isSetMillisSinceUpdate()); if (lastComparison != 0) { return lastComparison; } if (isSetMillisSinceUpdate()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.millisSinceUpdate, typedOther.millisSinceUpdate); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (field.id) { case 1: // NAME if (field.type == org.apache.thrift.protocol.TType.STRING) { this.name = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 2: // STORAGE_ID if (field.type == org.apache.thrift.protocol.TType.STRING) { this.storageID = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 3: // HOST if (field.type == org.apache.thrift.protocol.TType.STRING) { this.host = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 4: // THRIFT_PORT if (field.type == org.apache.thrift.protocol.TType.I32) { this.thriftPort = iprot.readI32(); setThriftPortIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 10: // HTTP_PORT if (field.type == org.apache.thrift.protocol.TType.I32) { this.httpPort = iprot.readI32(); setHttpPortIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 5: // CAPACITY if (field.type == org.apache.thrift.protocol.TType.I64) { this.capacity = iprot.readI64(); setCapacityIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 6: // DFS_USED if (field.type == org.apache.thrift.protocol.TType.I64) { this.dfsUsed = iprot.readI64(); setDfsUsedIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 7: // REMAINING if (field.type == org.apache.thrift.protocol.TType.I64) { this.remaining = iprot.readI64(); setRemainingIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 8: // XCEIVER_COUNT if (field.type == org.apache.thrift.protocol.TType.I32) { this.xceiverCount = iprot.readI32(); setXceiverCountIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 9: // STATE if (field.type == org.apache.thrift.protocol.TType.I32) { this.state = DatanodeState.findByValue(iprot.readI32()); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 11: // MILLIS_SINCE_UPDATE if (field.type == org.apache.thrift.protocol.TType.I64) { this.millisSinceUpdate = iprot.readI64(); setMillisSinceUpdateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.name != null) { oprot.writeFieldBegin(NAME_FIELD_DESC); oprot.writeString(this.name); oprot.writeFieldEnd(); } if (this.storageID != null) { oprot.writeFieldBegin(STORAGE_ID_FIELD_DESC); oprot.writeString(this.storageID); oprot.writeFieldEnd(); } if (this.host != null) { oprot.writeFieldBegin(HOST_FIELD_DESC); oprot.writeString(this.host); oprot.writeFieldEnd(); } oprot.writeFieldBegin(THRIFT_PORT_FIELD_DESC); oprot.writeI32(this.thriftPort); oprot.writeFieldEnd(); oprot.writeFieldBegin(CAPACITY_FIELD_DESC); oprot.writeI64(this.capacity); oprot.writeFieldEnd(); oprot.writeFieldBegin(DFS_USED_FIELD_DESC); oprot.writeI64(this.dfsUsed); oprot.writeFieldEnd(); oprot.writeFieldBegin(REMAINING_FIELD_DESC); oprot.writeI64(this.remaining); oprot.writeFieldEnd(); oprot.writeFieldBegin(XCEIVER_COUNT_FIELD_DESC); oprot.writeI32(this.xceiverCount); oprot.writeFieldEnd(); if (this.state != null) { oprot.writeFieldBegin(STATE_FIELD_DESC); oprot.writeI32(this.state.getValue()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(HTTP_PORT_FIELD_DESC); oprot.writeI32(this.httpPort); oprot.writeFieldEnd(); oprot.writeFieldBegin(MILLIS_SINCE_UPDATE_FIELD_DESC); oprot.writeI64(this.millisSinceUpdate); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("DatanodeInfo("); boolean first = true; sb.append("name:"); if (this.name == null) { sb.append("null"); } else { sb.append(this.name); } first = false; if (!first) sb.append(", "); sb.append("storageID:"); if (this.storageID == null) { sb.append("null"); } else { sb.append(this.storageID); } first = false; if (!first) sb.append(", "); sb.append("host:"); if (this.host == null) { sb.append("null"); } else { sb.append(this.host); } first = false; if (!first) sb.append(", "); sb.append("thriftPort:"); sb.append(this.thriftPort); first = false; if (!first) sb.append(", "); sb.append("httpPort:"); sb.append(this.httpPort); first = false; if (!first) sb.append(", "); sb.append("capacity:"); sb.append(this.capacity); first = false; if (!first) sb.append(", "); sb.append("dfsUsed:"); sb.append(this.dfsUsed); first = false; if (!first) sb.append(", "); sb.append("remaining:"); sb.append(this.remaining); first = false; if (!first) sb.append(", "); sb.append("xceiverCount:"); sb.append(this.xceiverCount); first = false; if (!first) sb.append(", "); sb.append("state:"); if (this.state == null) { sb.append("null"); } else { sb.append(this.state); } first = false; if (!first) sb.append(", "); sb.append("millisSinceUpdate:"); sb.append(this.millisSinceUpdate); first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } }