public TDiskUsage deepCopy() { return new TDiskUsage(this); }
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TDiskUsage) return this.equals((TDiskUsage)that); return false; }
public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case TABLES: if (value == null) { unsetTables(); } else { setTables((java.util.List<java.lang.String>)value); } break; case USAGE: if (value == null) { unsetUsage(); } else { setUsage((java.lang.Long)value); } break; } }
/** 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 java.lang.IllegalArgumentException(); } switch (field) { case TABLES: return isSetTables(); case USAGE: return isSetUsage(); } throw new java.lang.IllegalStateException(); }
struct.setTablesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.usage = iprot.readI64(); struct.setUsageIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TDiskUsage struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.tables = new java.util.ArrayList<java.lang.String>(_list5.size); java.lang.String _elem6; for (int _i7 = 0; _i7 < _list5.size; ++_i7) { _elem6 = iprot.readString(); struct.tables.add(_elem6); } } struct.setTablesIsSet(true); } if (incoming.get(1)) { struct.usage = iprot.readI64(); struct.setUsageIsSet(true); } } }
/** * Performs a deep copy on <i>other</i>. */ public TDiskUsage(TDiskUsage other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetTables()) { java.util.List<java.lang.String> __this__tables = new java.util.ArrayList<java.lang.String>(other.tables); this.tables = __this__tables; } this.usage = other.usage; }
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { scheme(iprot).read(iprot, this); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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_bitfield = 0; 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); } }
@Override public int compareTo(TDiskUsage other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = java.lang.Boolean.valueOf(isSetTables()).compareTo(other.isSetTables()); if (lastComparison != 0) { return lastComparison; } if (isSetTables()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tables, other.tables); if (lastComparison != 0) { return lastComparison; } } lastComparison = java.lang.Boolean.valueOf(isSetUsage()).compareTo(other.isSetUsage()); if (lastComparison != 0) { return lastComparison; } if (isSetUsage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.usage, other.usage); if (lastComparison != 0) { return lastComparison; } } return 0; }
public boolean equals(TDiskUsage that) { if (that == null) return false; if (this == that) return true; boolean this_present_tables = true && this.isSetTables(); boolean that_present_tables = true && that.isSetTables(); if (this_present_tables || that_present_tables) { if (!(this_present_tables && that_present_tables)) return false; if (!this.tables.equals(that.tables)) return false; } boolean this_present_usage = true; boolean that_present_usage = true; if (this_present_usage || that_present_usage) { if (!(this_present_usage && that_present_usage)) return false; if (this.usage != that.usage) return false; } return true; }
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { scheme(oprot).write(oprot, this); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TDiskUsage struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetTables()) { optionals.set(0); } if (struct.isSetUsage()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetTables()) { { oprot.writeI32(struct.tables.size()); for (java.lang.String _iter4 : struct.tables) { oprot.writeString(_iter4); } } } if (struct.isSetUsage()) { oprot.writeI64(struct.usage); } }
@Override public List<TDiskUsage> getDiskUsage(Set<String> tables, TCredentials credentials) throws ThriftTableOperationException, ThriftSecurityException, TException { try { HashSet<Table.ID> tableIds = new HashSet<>(); for (String table : tables) { // ensure that table table exists Table.ID tableId = checkTableId(context, table, null); tableIds.add(tableId); Namespace.ID namespaceId = Tables.getNamespaceId(context, tableId); if (!security.canScan(credentials, tableId, namespaceId)) throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); } // use the same set of tableIds that were validated above to avoid race conditions Map<TreeSet<String>,Long> diskUsage = TableDiskUsage.getDiskUsage(tableIds, fs, context); List<TDiskUsage> retUsages = new ArrayList<>(); for (Map.Entry<TreeSet<String>,Long> usageItem : diskUsage.entrySet()) { retUsages.add(new TDiskUsage(new ArrayList<>(usageItem.getKey()), usageItem.getValue())); } return retUsages; } catch (TableNotFoundException | IOException e) { throw new TException(e); } }
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetTables()) ? 131071 : 524287); if (isSetTables()) hashCode = hashCode * 8191 + tables.hashCode(); hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(usage); return hashCode; }