Ejemplo n.º 1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, BlockInfo struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetBlockId()) {
     optionals.set(0);
   }
   if (struct.isSetLength()) {
     optionals.set(1);
   }
   if (struct.isSetLocations()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetBlockId()) {
     oprot.writeI64(struct.blockId);
   }
   if (struct.isSetLength()) {
     oprot.writeI64(struct.length);
   }
   if (struct.isSetLocations()) {
     {
       oprot.writeI32(struct.locations.size());
       for (BlockLocation _iter4 : struct.locations) {
         _iter4.write(oprot);
       }
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, BlockInfo struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.blockId = iprot.readI64();
     struct.setBlockIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.length = iprot.readI64();
     struct.setLengthIsSet(true);
   }
   if (incoming.get(2)) {
     {
       org.apache.thrift.protocol.TList _list5 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
       struct.locations = new ArrayList<BlockLocation>(_list5.size);
       BlockLocation _elem6;
       for (int _i7 = 0; _i7 < _list5.size; ++_i7) {
         _elem6 = new BlockLocation();
         _elem6.read(iprot);
         struct.locations.add(_elem6);
       }
     }
     struct.setLocationsIsSet(true);
   }
 }
Ejemplo n.º 3
0
  public boolean equals(BlockLocation that) {
    if (that == null) return false;

    boolean this_present_workerId = true;
    boolean that_present_workerId = true;
    if (this_present_workerId || that_present_workerId) {
      if (!(this_present_workerId && that_present_workerId)) return false;
      if (this.workerId != that.workerId) return false;
    }

    boolean this_present_workerAddress = true && this.isSetWorkerAddress();
    boolean that_present_workerAddress = true && that.isSetWorkerAddress();
    if (this_present_workerAddress || that_present_workerAddress) {
      if (!(this_present_workerAddress && that_present_workerAddress)) return false;
      if (!this.workerAddress.equals(that.workerAddress)) return false;
    }

    boolean this_present_tierAlias = true && this.isSetTierAlias();
    boolean that_present_tierAlias = true && that.isSetTierAlias();
    if (this_present_tierAlias || that_present_tierAlias) {
      if (!(this_present_tierAlias && that_present_tierAlias)) return false;
      if (!this.tierAlias.equals(that.tierAlias)) return false;
    }

    return true;
  }
Ejemplo n.º 4
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, BlockInfo struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(BLOCK_ID_FIELD_DESC);
      oprot.writeI64(struct.blockId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(LENGTH_FIELD_DESC);
      oprot.writeI64(struct.length);
      oprot.writeFieldEnd();
      if (struct.locations != null) {
        oprot.writeFieldBegin(LOCATIONS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.locations.size()));
          for (BlockLocation _iter3 : struct.locations) {
            _iter3.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Ejemplo n.º 5
0
 /** Performs a deep copy on <i>other</i>. */
 public BlockLocation(BlockLocation other) {
   __isset_bitfield = other.__isset_bitfield;
   this.workerId = other.workerId;
   if (other.isSetWorkerAddress()) {
     this.workerAddress = other.workerAddress;
   }
   if (other.isSetTierAlias()) {
     this.tierAlias = other.tierAlias;
   }
 }
Ejemplo n.º 6
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, BlockInfo struct)
        throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // BLOCK_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.blockId = iprot.readI64();
              struct.setBlockIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LENGTH
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.length = iprot.readI64();
              struct.setLengthIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // LOCATIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                struct.locations = new ArrayList<BlockLocation>(_list0.size);
                BlockLocation _elem1;
                for (int _i2 = 0; _i2 < _list0.size; ++_i2) {
                  _elem1 = new BlockLocation();
                  _elem1.read(iprot);
                  struct.locations.add(_elem1);
                }
                iprot.readListEnd();
              }
              struct.setLocationsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }
Ejemplo n.º 7
0
  @Override
  public int compareTo(BlockLocation other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetWorkerId()).compareTo(other.isSetWorkerId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWorkerId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerId, other.workerId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetWorkerAddress()).compareTo(other.isSetWorkerAddress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWorkerAddress()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.workerAddress, other.workerAddress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTierAlias()).compareTo(other.isSetTierAlias());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTierAlias()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tierAlias, other.tierAlias);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Ejemplo n.º 8
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, BlockLocation struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetWorkerId()) {
     optionals.set(0);
   }
   if (struct.isSetWorkerAddress()) {
     optionals.set(1);
   }
   if (struct.isSetTierAlias()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetWorkerId()) {
     oprot.writeI64(struct.workerId);
   }
   if (struct.isSetWorkerAddress()) {
     struct.workerAddress.write(oprot);
   }
   if (struct.isSetTierAlias()) {
     oprot.writeString(struct.tierAlias);
   }
 }
Ejemplo n.º 9
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, BlockLocation struct)
        throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // WORKER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.workerId = iprot.readI64();
              struct.setWorkerIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // WORKER_ADDRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.workerAddress = new WorkerNetAddress();
              struct.workerAddress.read(iprot);
              struct.setWorkerAddressIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TIER_ALIAS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tierAlias = iprot.readString();
              struct.setTierAliasIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }
Ejemplo n.º 10
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, BlockLocation struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(WORKER_ID_FIELD_DESC);
      oprot.writeI64(struct.workerId);
      oprot.writeFieldEnd();
      if (struct.workerAddress != null) {
        oprot.writeFieldBegin(WORKER_ADDRESS_FIELD_DESC);
        struct.workerAddress.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.tierAlias != null) {
        oprot.writeFieldBegin(TIER_ALIAS_FIELD_DESC);
        oprot.writeString(struct.tierAlias);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Ejemplo n.º 11
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, BlockLocation struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.workerId = iprot.readI64();
     struct.setWorkerIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.workerAddress = new WorkerNetAddress();
     struct.workerAddress.read(iprot);
     struct.setWorkerAddressIsSet(true);
   }
   if (incoming.get(2)) {
     struct.tierAlias = iprot.readString();
     struct.setTierAliasIsSet(true);
   }
 }