Beispiel #1
0
  public int compareTo(TabletSplit other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TabletSplit typedOther = (TabletSplit) other;

    lastComparison = Boolean.valueOf(isSetOldTablet()).compareTo(typedOther.isSetOldTablet());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOldTablet()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.oldTablet, typedOther.oldTablet);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNewTablets()).compareTo(typedOther.isSetNewTablets());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNewTablets()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.newTablets, typedOther.newTablets);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Beispiel #2
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TabletSplit struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.oldTablet = new org.apache.accumulo.core.data.thrift.TKeyExtent();
     struct.oldTablet.read(iprot);
     struct.setOldTabletIsSet(true);
   }
   if (incoming.get(1)) {
     {
       org.apache.thrift.protocol.TList _list67 =
           new org.apache.thrift.protocol.TList(
               org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
       struct.newTablets =
           new ArrayList<org.apache.accumulo.core.data.thrift.TKeyExtent>(_list67.size);
       for (int _i68 = 0; _i68 < _list67.size; ++_i68) {
         org.apache.accumulo.core.data.thrift.TKeyExtent _elem69; // required
         _elem69 = new org.apache.accumulo.core.data.thrift.TKeyExtent();
         _elem69.read(iprot);
         struct.newTablets.add(_elem69);
       }
     }
     struct.setNewTabletsIsSet(true);
   }
 }
 public void send(TCredentials credentials, String serverName, MasterClientService.Iface client)
     throws TException, ThriftSecurityException {
   TabletSplit split = new TabletSplit();
   split.oldTablet = old_extent.toThrift();
   split.newTablets = Translator.translate(extents.keySet(), Translators.KET);
   client.reportSplitExtent(Tracer.traceInfo(), credentials, serverName, split);
 }
Beispiel #4
0
 /** Performs a deep copy on <i>other</i>. */
 public TabletSplit(TabletSplit other) {
   if (other.isSetOldTablet()) {
     this.oldTablet = new org.apache.accumulo.core.data.thrift.TKeyExtent(other.oldTablet);
   }
   if (other.isSetNewTablets()) {
     List<org.apache.accumulo.core.data.thrift.TKeyExtent> __this__newTablets =
         new ArrayList<org.apache.accumulo.core.data.thrift.TKeyExtent>();
     for (org.apache.accumulo.core.data.thrift.TKeyExtent other_element : other.newTablets) {
       __this__newTablets.add(new org.apache.accumulo.core.data.thrift.TKeyExtent(other_element));
     }
     this.newTablets = __this__newTablets;
   }
 }
Beispiel #5
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TabletSplit 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: // OLD_TABLET
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.oldTablet = new org.apache.accumulo.core.data.thrift.TKeyExtent();
              struct.oldTablet.read(iprot);
              struct.setOldTabletIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // NEW_TABLETS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list62 = iprot.readListBegin();
                struct.newTablets =
                    new ArrayList<org.apache.accumulo.core.data.thrift.TKeyExtent>(_list62.size);
                for (int _i63 = 0; _i63 < _list62.size; ++_i63) {
                  org.apache.accumulo.core.data.thrift.TKeyExtent _elem64; // required
                  _elem64 = new org.apache.accumulo.core.data.thrift.TKeyExtent();
                  _elem64.read(iprot);
                  struct.newTablets.add(_elem64);
                }
                iprot.readListEnd();
              }
              struct.setNewTabletsIsSet(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();
    }
Beispiel #6
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TabletSplit struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.oldTablet != null) {
        oprot.writeFieldBegin(OLD_TABLET_FIELD_DESC);
        struct.oldTablet.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.newTablets != null) {
        oprot.writeFieldBegin(NEW_TABLETS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.newTablets.size()));
          for (org.apache.accumulo.core.data.thrift.TKeyExtent _iter65 : struct.newTablets) {
            _iter65.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Beispiel #7
0
  public boolean equals(TabletSplit that) {
    if (that == null) return false;

    boolean this_present_oldTablet = true && this.isSetOldTablet();
    boolean that_present_oldTablet = true && that.isSetOldTablet();
    if (this_present_oldTablet || that_present_oldTablet) {
      if (!(this_present_oldTablet && that_present_oldTablet)) return false;
      if (!this.oldTablet.equals(that.oldTablet)) return false;
    }

    boolean this_present_newTablets = true && this.isSetNewTablets();
    boolean that_present_newTablets = true && that.isSetNewTablets();
    if (this_present_newTablets || that_present_newTablets) {
      if (!(this_present_newTablets && that_present_newTablets)) return false;
      if (!this.newTablets.equals(that.newTablets)) return false;
    }

    return true;
  }
Beispiel #8
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TabletSplit struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetOldTablet()) {
     optionals.set(0);
   }
   if (struct.isSetNewTablets()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetOldTablet()) {
     struct.oldTablet.write(oprot);
   }
   if (struct.isSetNewTablets()) {
     {
       oprot.writeI32(struct.newTablets.size());
       for (org.apache.accumulo.core.data.thrift.TKeyExtent _iter66 : struct.newTablets) {
         _iter66.write(oprot);
       }
     }
   }
 }