http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionServiceThriftHandler.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionServiceThriftHandler.java b/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionServiceThriftHandler.java new file mode 100644 index 0000000..8edc1a6 --- /dev/null +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionServiceThriftHandler.java @@ -0,0 +1,184 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tephra.distributed; + +import com.google.common.collect.Sets; +import org.apache.tephra.InvalidTruncateTimeException; +import org.apache.tephra.TransactionManager; +import org.apache.tephra.TransactionNotInProgressException; +import org.apache.tephra.TxConstants; +import org.apache.tephra.distributed.thrift.TBoolean; +import org.apache.tephra.distributed.thrift.TInvalidTruncateTimeException; +import org.apache.tephra.distributed.thrift.TTransaction; +import org.apache.tephra.distributed.thrift.TTransactionCouldNotTakeSnapshotException; +import org.apache.tephra.distributed.thrift.TTransactionNotInProgressException; +import org.apache.tephra.distributed.thrift.TTransactionServer; +import org.apache.tephra.rpc.RPCServiceHandler; +import org.apache.thrift.TException; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Set; + +/** + * The implementation of a thrift service for tx service. + * All operations arrive over the wire as Thrift objects. + * <p/> + * Why all this conversion (wrap/unwrap), and not define all Operations + * themselves as Thrift objects? + * <ul><li> + * All the non-thrift executors would have to use the Thrift objects + * </li><li> + * Thrift's object model is too restrictive: it has only limited inheritance + * and no overloading + * </li><li> + * Thrift objects are bare-bone, all they have are getters, setters, and + * basic object methods. + * </li></ul> + */ +public class TransactionServiceThriftHandler implements TTransactionServer.Iface, RPCServiceHandler { + + private final TransactionManager txManager; + + public TransactionServiceThriftHandler(TransactionManager txManager) { + this.txManager = txManager; + } + + @Override + public TTransaction startLong() throws TException { + return TransactionConverterUtils.wrap(txManager.startLong()); + } + + @Override + public TTransaction startShort() throws TException { + return TransactionConverterUtils.wrap(txManager.startShort()); + } + + @Override + public TTransaction startShortTimeout(int timeout) throws TException { + return TransactionConverterUtils.wrap(txManager.startShort(timeout)); + } + + + @Override + public TBoolean canCommitTx(TTransaction tx, Set<ByteBuffer> changes) throws TException { + + Set<byte[]> changeIds = Sets.newHashSet(); + for (ByteBuffer bb : changes) { + byte[] changeId = new byte[bb.remaining()]; + bb.get(changeId); + changeIds.add(changeId); + } + try { + return new TBoolean(txManager.canCommit(TransactionConverterUtils.unwrap(tx), changeIds)); + } catch (TransactionNotInProgressException e) { + throw new TTransactionNotInProgressException(e.getMessage()); + } + } + + @Override + public TBoolean commitTx(TTransaction tx) throws TException { + try { + return new TBoolean(txManager.commit(TransactionConverterUtils.unwrap(tx))); + } catch (TransactionNotInProgressException e) { + throw new TTransactionNotInProgressException(e.getMessage()); + } + } + + @Override + public void abortTx(TTransaction tx) throws TException { + txManager.abort(TransactionConverterUtils.unwrap(tx)); + } + + @Override + public boolean invalidateTx(long tx) throws TException { + return txManager.invalidate(tx); + } + + @Override + public ByteBuffer getSnapshot() throws TException { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + boolean snapshotTaken = txManager.takeSnapshot(out); + if (!snapshotTaken) { + throw new TTransactionCouldNotTakeSnapshotException("Transaction manager could not get a snapshot."); + } + } finally { + out.close(); + } + // todo find a way to encode directly to the stream, without having the snapshot in memory twice + return ByteBuffer.wrap(out.toByteArray()); + } catch (IOException e) { + throw new TTransactionCouldNotTakeSnapshotException(e.getMessage()); + } + } + + @Override + public void resetState() throws TException { + txManager.resetState(); + } + + @Override + public String status() throws TException { + return txManager.isRunning() ? TxConstants.STATUS_OK : TxConstants.STATUS_NOTOK; + } + + @Override + public TBoolean truncateInvalidTx(Set<Long> txns) throws TException { + return new TBoolean(txManager.truncateInvalidTx(txns)); + } + + @Override + public TBoolean truncateInvalidTxBefore(long time) throws TException { + try { + return new TBoolean(txManager.truncateInvalidTxBefore(time)); + } catch (InvalidTruncateTimeException e) { + throw new TInvalidTruncateTimeException(e.getMessage()); + } + } + + @Override + public int invalidTxSize() throws TException { + return txManager.getInvalidSize(); + } + + @Override + public TTransaction checkpoint(TTransaction originalTx) throws TException { + try { + return TransactionConverterUtils.wrap( + txManager.checkpoint(TransactionConverterUtils.unwrap(originalTx))); + } catch (TransactionNotInProgressException e) { + throw new TTransactionNotInProgressException(e.getMessage()); + } + } + + /* RPCServiceHandler implementation */ + + @Override + public void init() throws Exception { + txManager.startAndWait(); + } + + @Override + public void destroy() throws Exception { + txManager.stopAndWait(); + } +}
http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-core/src/main/java/org/apache/tephra/distributed/package-info.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/package-info.java b/tephra-core/src/main/java/org/apache/tephra/distributed/package-info.java new file mode 100644 index 0000000..e001968 --- /dev/null +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/package-info.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This package contains standalone server of the transaction system v2. It is now simple netty piece, but will change + * we integrate new RPC + */ +package org.apache.tephra.distributed; http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TBoolean.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TBoolean.java b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TBoolean.java new file mode 100644 index 0000000..d33c7aa --- /dev/null +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TBoolean.java @@ -0,0 +1,392 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.tephra.distributed.thrift; + +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class TBoolean implements org.apache.thrift.TBase<TBoolean, TBoolean._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TBoolean"); + + private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.BOOL, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TBooleanStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TBooleanTupleSchemeFactory()); + } + + public boolean value; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + VALUE((short)1, "value"); + + 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: // VALUE + return VALUE; + 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 __VALUE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + 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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TBoolean.class, metaDataMap); + } + + public TBoolean() { + } + + public TBoolean( + boolean value) + { + this(); + this.value = value; + setValueIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TBoolean(TBoolean other) { + __isset_bitfield = other.__isset_bitfield; + this.value = other.value; + } + + public TBoolean deepCopy() { + return new TBoolean(this); + } + + @Override + public void clear() { + setValueIsSet(false); + this.value = false; + } + + public boolean isValue() { + return this.value; + } + + public TBoolean setValue(boolean value) { + this.value = value; + setValueIsSet(true); + return this; + } + + public void unsetValue() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID); + } + + /** Returns true if field value is set (has been assigned a value) and false otherwise */ + public boolean isSetValue() { + return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID); + } + + public void setValueIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case VALUE: + if (value == null) { + unsetValue(); + } else { + setValue((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case VALUE: + return Boolean.valueOf(isValue()); + + } + 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 VALUE: + return isSetValue(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TBoolean) + return this.equals((TBoolean)that); + return false; + } + + public boolean equals(TBoolean that) { + if (that == null) + return false; + + boolean this_present_value = true; + boolean that_present_value = true; + if (this_present_value || that_present_value) { + if (!(this_present_value && that_present_value)) + return false; + if (this.value != that.value) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(TBoolean other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TBoolean typedOther = (TBoolean)other; + + lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValue()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value); + 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 { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TBoolean("); + boolean first = true; + + sb.append("value:"); + sb.append(this.value); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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_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); + } + } + + private static class TBooleanStandardSchemeFactory implements SchemeFactory { + public TBooleanStandardScheme getScheme() { + return new TBooleanStandardScheme(); + } + } + + private static class TBooleanStandardScheme extends StandardScheme<TBoolean> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TBoolean 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: // VALUE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.value = iprot.readBool(); + struct.setValueIsSet(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(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TBoolean struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(VALUE_FIELD_DESC); + oprot.writeBool(struct.value); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TBooleanTupleSchemeFactory implements SchemeFactory { + public TBooleanTupleScheme getScheme() { + return new TBooleanTupleScheme(); + } + } + + private static class TBooleanTupleScheme extends TupleScheme<TBoolean> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TBoolean struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetValue()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetValue()) { + oprot.writeBool(struct.value); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TBoolean struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.value = iprot.readBool(); + struct.setValueIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TInvalidTruncateTimeException.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TInvalidTruncateTimeException.java b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TInvalidTruncateTimeException.java new file mode 100644 index 0000000..6587ae0 --- /dev/null +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TInvalidTruncateTimeException.java @@ -0,0 +1,394 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.tephra.distributed.thrift; + +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class TInvalidTruncateTimeException extends TException implements org.apache.thrift.TBase<TInvalidTruncateTimeException, TInvalidTruncateTimeException._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TInvalidTruncateTimeException"); + + private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TInvalidTruncateTimeExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TInvalidTruncateTimeExceptionTupleSchemeFactory()); + } + + public String message; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + MESSAGE((short)1, "message"); + + 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: // MESSAGE + return MESSAGE; + 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 + 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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TInvalidTruncateTimeException.class, metaDataMap); + } + + public TInvalidTruncateTimeException() { + } + + public TInvalidTruncateTimeException( + String message) + { + this(); + this.message = message; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TInvalidTruncateTimeException(TInvalidTruncateTimeException other) { + if (other.isSetMessage()) { + this.message = other.message; + } + } + + public TInvalidTruncateTimeException deepCopy() { + return new TInvalidTruncateTimeException(this); + } + + @Override + public void clear() { + this.message = null; + } + + public String getMessage() { + return this.message; + } + + public TInvalidTruncateTimeException setMessage(String message) { + this.message = message; + return this; + } + + public void unsetMessage() { + this.message = null; + } + + /** Returns true if field message is set (has been assigned a value) and false otherwise */ + public boolean isSetMessage() { + return this.message != null; + } + + public void setMessageIsSet(boolean value) { + if (!value) { + this.message = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case MESSAGE: + if (value == null) { + unsetMessage(); + } else { + setMessage((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case MESSAGE: + return getMessage(); + + } + 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 MESSAGE: + return isSetMessage(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TInvalidTruncateTimeException) + return this.equals((TInvalidTruncateTimeException)that); + return false; + } + + public boolean equals(TInvalidTruncateTimeException that) { + if (that == null) + return false; + + boolean this_present_message = true && this.isSetMessage(); + boolean that_present_message = true && that.isSetMessage(); + if (this_present_message || that_present_message) { + if (!(this_present_message && that_present_message)) + return false; + if (!this.message.equals(that.message)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(TInvalidTruncateTimeException other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TInvalidTruncateTimeException typedOther = (TInvalidTruncateTimeException)other; + + lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMessage()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message); + 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 { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TInvalidTruncateTimeException("); + boolean first = true; + + sb.append("message:"); + if (this.message == null) { + sb.append("null"); + } else { + sb.append(this.message); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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 { + 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); + } + } + + private static class TInvalidTruncateTimeExceptionStandardSchemeFactory implements SchemeFactory { + public TInvalidTruncateTimeExceptionStandardScheme getScheme() { + return new TInvalidTruncateTimeExceptionStandardScheme(); + } + } + + private static class TInvalidTruncateTimeExceptionStandardScheme extends StandardScheme<TInvalidTruncateTimeException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TInvalidTruncateTimeException 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: // MESSAGE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.message = iprot.readString(); + struct.setMessageIsSet(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(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TInvalidTruncateTimeException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.message != null) { + oprot.writeFieldBegin(MESSAGE_FIELD_DESC); + oprot.writeString(struct.message); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TInvalidTruncateTimeExceptionTupleSchemeFactory implements SchemeFactory { + public TInvalidTruncateTimeExceptionTupleScheme getScheme() { + return new TInvalidTruncateTimeExceptionTupleScheme(); + } + } + + private static class TInvalidTruncateTimeExceptionTupleScheme extends TupleScheme<TInvalidTruncateTimeException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TInvalidTruncateTimeException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetMessage()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetMessage()) { + oprot.writeString(struct.message); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TInvalidTruncateTimeException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.message = iprot.readString(); + struct.setMessageIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TTransaction.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TTransaction.java b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TTransaction.java new file mode 100644 index 0000000..ae2f72d --- /dev/null +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/thrift/TTransaction.java @@ -0,0 +1,1364 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.tephra.distributed.thrift; + +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTransaction._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTransaction"); + + private static final org.apache.thrift.protocol.TField TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionId", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField READ_POINTER_FIELD_DESC = new org.apache.thrift.protocol.TField("readPointer", org.apache.thrift.protocol.TType.I64, (short)2); + private static final org.apache.thrift.protocol.TField INVALIDS_FIELD_DESC = new org.apache.thrift.protocol.TField("invalids", org.apache.thrift.protocol.TType.LIST, (short)3); + private static final org.apache.thrift.protocol.TField IN_PROGRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("inProgress", org.apache.thrift.protocol.TType.LIST, (short)4); + private static final org.apache.thrift.protocol.TField FIRST_SHORT_FIELD_DESC = new org.apache.thrift.protocol.TField("firstShort", org.apache.thrift.protocol.TType.I64, (short)5); + private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)6); + private static final org.apache.thrift.protocol.TField WRITE_POINTER_FIELD_DESC = new org.apache.thrift.protocol.TField("writePointer", org.apache.thrift.protocol.TType.I64, (short)7); + private static final org.apache.thrift.protocol.TField CHECKPOINT_WRITE_POINTERS_FIELD_DESC = new org.apache.thrift.protocol.TField("checkpointWritePointers", org.apache.thrift.protocol.TType.LIST, (short)8); + private static final org.apache.thrift.protocol.TField VISIBILITY_LEVEL_FIELD_DESC = new org.apache.thrift.protocol.TField("visibilityLevel", org.apache.thrift.protocol.TType.I32, (short)9); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TTransactionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TTransactionTupleSchemeFactory()); + } + + public long transactionId; // required + public long readPointer; // required + public List<Long> invalids; // required + public List<Long> inProgress; // required + public long firstShort; // required + /** + * + * @see TTransactionType + */ + public TTransactionType type; // required + public long writePointer; // required + public List<Long> checkpointWritePointers; // required + /** + * + * @see TVisibilityLevel + */ + public TVisibilityLevel visibilityLevel; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + TRANSACTION_ID((short)1, "transactionId"), + READ_POINTER((short)2, "readPointer"), + INVALIDS((short)3, "invalids"), + IN_PROGRESS((short)4, "inProgress"), + FIRST_SHORT((short)5, "firstShort"), + /** + * + * @see TTransactionType + */ + TYPE((short)6, "type"), + WRITE_POINTER((short)7, "writePointer"), + CHECKPOINT_WRITE_POINTERS((short)8, "checkpointWritePointers"), + /** + * + * @see TVisibilityLevel + */ + VISIBILITY_LEVEL((short)9, "visibilityLevel"); + + 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: // TRANSACTION_ID + return TRANSACTION_ID; + case 2: // READ_POINTER + return READ_POINTER; + case 3: // INVALIDS + return INVALIDS; + case 4: // IN_PROGRESS + return IN_PROGRESS; + case 5: // FIRST_SHORT + return FIRST_SHORT; + case 6: // TYPE + return TYPE; + case 7: // WRITE_POINTER + return WRITE_POINTER; + case 8: // CHECKPOINT_WRITE_POINTERS + return CHECKPOINT_WRITE_POINTERS; + case 9: // VISIBILITY_LEVEL + return VISIBILITY_LEVEL; + 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 __TRANSACTIONID_ISSET_ID = 0; + private static final int __READPOINTER_ISSET_ID = 1; + private static final int __FIRSTSHORT_ISSET_ID = 2; + private static final int __WRITEPOINTER_ISSET_ID = 3; + private byte __isset_bitfield = 0; + 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.TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("transactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.READ_POINTER, new org.apache.thrift.meta_data.FieldMetaData("readPointer", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.INVALIDS, new org.apache.thrift.meta_data.FieldMetaData("invalids", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); + tmpMap.put(_Fields.IN_PROGRESS, new org.apache.thrift.meta_data.FieldMetaData("inProgress", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); + tmpMap.put(_Fields.FIRST_SHORT, new org.apache.thrift.meta_data.FieldMetaData("firstShort", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TTransactionType.class))); + tmpMap.put(_Fields.WRITE_POINTER, new org.apache.thrift.meta_data.FieldMetaData("writePointer", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.CHECKPOINT_WRITE_POINTERS, new org.apache.thrift.meta_data.FieldMetaData("checkpointWritePointers", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)))); + tmpMap.put(_Fields.VISIBILITY_LEVEL, new org.apache.thrift.meta_data.FieldMetaData("visibilityLevel", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TVisibilityLevel.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTransaction.class, metaDataMap); + } + + public TTransaction() { + } + + public TTransaction( + long transactionId, + long readPointer, + List<Long> invalids, + List<Long> inProgress, + long firstShort, + TTransactionType type, + long writePointer, + List<Long> checkpointWritePointers, + TVisibilityLevel visibilityLevel) + { + this(); + this.transactionId = transactionId; + setTransactionIdIsSet(true); + this.readPointer = readPointer; + setReadPointerIsSet(true); + this.invalids = invalids; + this.inProgress = inProgress; + this.firstShort = firstShort; + setFirstShortIsSet(true); + this.type = type; + this.writePointer = writePointer; + setWritePointerIsSet(true); + this.checkpointWritePointers = checkpointWritePointers; + this.visibilityLevel = visibilityLevel; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public TTransaction(TTransaction other) { + __isset_bitfield = other.__isset_bitfield; + this.transactionId = other.transactionId; + this.readPointer = other.readPointer; + if (other.isSetInvalids()) { + List<Long> __this__invalids = new ArrayList<Long>(); + for (Long other_element : other.invalids) { + __this__invalids.add(other_element); + } + this.invalids = __this__invalids; + } + if (other.isSetInProgress()) { + List<Long> __this__inProgress = new ArrayList<Long>(); + for (Long other_element : other.inProgress) { + __this__inProgress.add(other_element); + } + this.inProgress = __this__inProgress; + } + this.firstShort = other.firstShort; + if (other.isSetType()) { + this.type = other.type; + } + this.writePointer = other.writePointer; + if (other.isSetCheckpointWritePointers()) { + List<Long> __this__checkpointWritePointers = new ArrayList<Long>(); + for (Long other_element : other.checkpointWritePointers) { + __this__checkpointWritePointers.add(other_element); + } + this.checkpointWritePointers = __this__checkpointWritePointers; + } + if (other.isSetVisibilityLevel()) { + this.visibilityLevel = other.visibilityLevel; + } + } + + public TTransaction deepCopy() { + return new TTransaction(this); + } + + @Override + public void clear() { + setTransactionIdIsSet(false); + this.transactionId = 0; + setReadPointerIsSet(false); + this.readPointer = 0; + this.invalids = null; + this.inProgress = null; + setFirstShortIsSet(false); + this.firstShort = 0; + this.type = null; + setWritePointerIsSet(false); + this.writePointer = 0; + this.checkpointWritePointers = null; + this.visibilityLevel = null; + } + + public long getTransactionId() { + return this.transactionId; + } + + public TTransaction setTransactionId(long transactionId) { + this.transactionId = transactionId; + setTransactionIdIsSet(true); + return this; + } + + public void unsetTransactionId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TRANSACTIONID_ISSET_ID); + } + + /** Returns true if field transactionId is set (has been assigned a value) and false otherwise */ + public boolean isSetTransactionId() { + return EncodingUtils.testBit(__isset_bitfield, __TRANSACTIONID_ISSET_ID); + } + + public void setTransactionIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TRANSACTIONID_ISSET_ID, value); + } + + public long getReadPointer() { + return this.readPointer; + } + + public TTransaction setReadPointer(long readPointer) { + this.readPointer = readPointer; + setReadPointerIsSet(true); + return this; + } + + public void unsetReadPointer() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __READPOINTER_ISSET_ID); + } + + /** Returns true if field readPointer is set (has been assigned a value) and false otherwise */ + public boolean isSetReadPointer() { + return EncodingUtils.testBit(__isset_bitfield, __READPOINTER_ISSET_ID); + } + + public void setReadPointerIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __READPOINTER_ISSET_ID, value); + } + + public int getInvalidsSize() { + return (this.invalids == null) ? 0 : this.invalids.size(); + } + + public java.util.Iterator<Long> getInvalidsIterator() { + return (this.invalids == null) ? null : this.invalids.iterator(); + } + + public void addToInvalids(long elem) { + if (this.invalids == null) { + this.invalids = new ArrayList<Long>(); + } + this.invalids.add(elem); + } + + public List<Long> getInvalids() { + return this.invalids; + } + + public TTransaction setInvalids(List<Long> invalids) { + this.invalids = invalids; + return this; + } + + public void unsetInvalids() { + this.invalids = null; + } + + /** Returns true if field invalids is set (has been assigned a value) and false otherwise */ + public boolean isSetInvalids() { + return this.invalids != null; + } + + public void setInvalidsIsSet(boolean value) { + if (!value) { + this.invalids = null; + } + } + + public int getInProgressSize() { + return (this.inProgress == null) ? 0 : this.inProgress.size(); + } + + public java.util.Iterator<Long> getInProgressIterator() { + return (this.inProgress == null) ? null : this.inProgress.iterator(); + } + + public void addToInProgress(long elem) { + if (this.inProgress == null) { + this.inProgress = new ArrayList<Long>(); + } + this.inProgress.add(elem); + } + + public List<Long> getInProgress() { + return this.inProgress; + } + + public TTransaction setInProgress(List<Long> inProgress) { + this.inProgress = inProgress; + return this; + } + + public void unsetInProgress() { + this.inProgress = null; + } + + /** Returns true if field inProgress is set (has been assigned a value) and false otherwise */ + public boolean isSetInProgress() { + return this.inProgress != null; + } + + public void setInProgressIsSet(boolean value) { + if (!value) { + this.inProgress = null; + } + } + + public long getFirstShort() { + return this.firstShort; + } + + public TTransaction setFirstShort(long firstShort) { + this.firstShort = firstShort; + setFirstShortIsSet(true); + return this; + } + + public void unsetFirstShort() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID); + } + + /** Returns true if field firstShort is set (has been assigned a value) and false otherwise */ + public boolean isSetFirstShort() { + return EncodingUtils.testBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID); + } + + public void setFirstShortIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FIRSTSHORT_ISSET_ID, value); + } + + /** + * + * @see TTransactionType + */ + public TTransactionType getType() { + return this.type; + } + + /** + * + * @see TTransactionType + */ + public TTransaction setType(TTransactionType type) { + this.type = type; + return this; + } + + public void unsetType() { + this.type = null; + } + + /** Returns true if field type is set (has been assigned a value) and false otherwise */ + public boolean isSetType() { + return this.type != null; + } + + public void setTypeIsSet(boolean value) { + if (!value) { + this.type = null; + } + } + + public long getWritePointer() { + return this.writePointer; + } + + public TTransaction setWritePointer(long writePointer) { + this.writePointer = writePointer; + setWritePointerIsSet(true); + return this; + } + + public void unsetWritePointer() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID); + } + + /** Returns true if field writePointer is set (has been assigned a value) and false otherwise */ + public boolean isSetWritePointer() { + return EncodingUtils.testBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID); + } + + public void setWritePointerIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITEPOINTER_ISSET_ID, value); + } + + public int getCheckpointWritePointersSize() { + return (this.checkpointWritePointers == null) ? 0 : this.checkpointWritePointers.size(); + } + + public java.util.Iterator<Long> getCheckpointWritePointersIterator() { + return (this.checkpointWritePointers == null) ? null : this.checkpointWritePointers.iterator(); + } + + public void addToCheckpointWritePointers(long elem) { + if (this.checkpointWritePointers == null) { + this.checkpointWritePointers = new ArrayList<Long>(); + } + this.checkpointWritePointers.add(elem); + } + + public List<Long> getCheckpointWritePointers() { + return this.checkpointWritePointers; + } + + public TTransaction setCheckpointWritePointers(List<Long> checkpointWritePointers) { + this.checkpointWritePointers = checkpointWritePointers; + return this; + } + + public void unsetCheckpointWritePointers() { + this.checkpointWritePointers = null; + } + + /** Returns true if field checkpointWritePointers is set (has been assigned a value) and false otherwise */ + public boolean isSetCheckpointWritePointers() { + return this.checkpointWritePointers != null; + } + + public void setCheckpointWritePointersIsSet(boolean value) { + if (!value) { + this.checkpointWritePointers = null; + } + } + + /** + * + * @see TVisibilityLevel + */ + public TVisibilityLevel getVisibilityLevel() { + return this.visibilityLevel; + } + + /** + * + * @see TVisibilityLevel + */ + public TTransaction setVisibilityLevel(TVisibilityLevel visibilityLevel) { + this.visibilityLevel = visibilityLevel; + return this; + } + + public void unsetVisibilityLevel() { + this.visibilityLevel = null; + } + + /** Returns true if field visibilityLevel is set (has been assigned a value) and false otherwise */ + public boolean isSetVisibilityLevel() { + return this.visibilityLevel != null; + } + + public void setVisibilityLevelIsSet(boolean value) { + if (!value) { + this.visibilityLevel = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TRANSACTION_ID: + if (value == null) { + unsetTransactionId(); + } else { + setTransactionId((Long)value); + } + break; + + case READ_POINTER: + if (value == null) { + unsetReadPointer(); + } else { + setReadPointer((Long)value); + } + break; + + case INVALIDS: + if (value == null) { + unsetInvalids(); + } else { + setInvalids((List<Long>)value); + } + break; + + case IN_PROGRESS: + if (value == null) { + unsetInProgress(); + } else { + setInProgress((List<Long>)value); + } + break; + + case FIRST_SHORT: + if (value == null) { + unsetFirstShort(); + } else { + setFirstShort((Long)value); + } + break; + + case TYPE: + if (value == null) { + unsetType(); + } else { + setType((TTransactionType)value); + } + break; + + case WRITE_POINTER: + if (value == null) { + unsetWritePointer(); + } else { + setWritePointer((Long)value); + } + break; + + case CHECKPOINT_WRITE_POINTERS: + if (value == null) { + unsetCheckpointWritePointers(); + } else { + setCheckpointWritePointers((List<Long>)value); + } + break; + + case VISIBILITY_LEVEL: + if (value == null) { + unsetVisibilityLevel(); + } else { + setVisibilityLevel((TVisibilityLevel)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TRANSACTION_ID: + return Long.valueOf(getTransactionId()); + + case READ_POINTER: + return Long.valueOf(getReadPointer()); + + case INVALIDS: + return getInvalids(); + + case IN_PROGRESS: + return getInProgress(); + + case FIRST_SHORT: + return Long.valueOf(getFirstShort()); + + case TYPE: + return getType(); + + case WRITE_POINTER: + return Long.valueOf(getWritePointer()); + + case CHECKPOINT_WRITE_POINTERS: + return getCheckpointWritePointers(); + + case VISIBILITY_LEVEL: + return getVisibilityLevel(); + + } + 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 TRANSACTION_ID: + return isSetTransactionId(); + case READ_POINTER: + return isSetReadPointer(); + case INVALIDS: + return isSetInvalids(); + case IN_PROGRESS: + return isSetInProgress(); + case FIRST_SHORT: + return isSetFirstShort(); + case TYPE: + return isSetType(); + case WRITE_POINTER: + return isSetWritePointer(); + case CHECKPOINT_WRITE_POINTERS: + return isSetCheckpointWritePointers(); + case VISIBILITY_LEVEL: + return isSetVisibilityLevel(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof TTransaction) + return this.equals((TTransaction)that); + return false; + } + + public boolean equals(TTransaction that) { + if (that == null) + return false; + + boolean this_present_transactionId = true; + boolean that_present_transactionId = true; + if (this_present_transactionId || that_present_transactionId) { + if (!(this_present_transactionId && that_present_transactionId)) + return false; + if (this.transactionId != that.transactionId) + return false; + } + + boolean this_present_readPointer = true; + boolean that_present_readPointer = true; + if (this_present_readPointer || that_present_readPointer) { + if (!(this_present_readPointer && that_present_readPointer)) + return false; + if (this.readPointer != that.readPointer) + return false; + } + + boolean this_present_invalids = true && this.isSetInvalids(); + boolean that_present_invalids = true && that.isSetInvalids(); + if (this_present_invalids || that_present_invalids) { + if (!(this_present_invalids && that_present_invalids)) + return false; + if (!this.invalids.equals(that.invalids)) + return false; + } + + boolean this_present_inProgress = true && this.isSetInProgress(); + boolean that_present_inProgress = true && that.isSetInProgress(); + if (this_present_inProgress || that_present_inProgress) { + if (!(this_present_inProgress && that_present_inProgress)) + return false; + if (!this.inProgress.equals(that.inProgress)) + return false; + } + + boolean this_present_firstShort = true; + boolean that_present_firstShort = true; + if (this_present_firstShort || that_present_firstShort) { + if (!(this_present_firstShort && that_present_firstShort)) + return false; + if (this.firstShort != that.firstShort) + return false; + } + + boolean this_present_type = true && this.isSetType(); + boolean that_present_type = true && that.isSetType(); + if (this_present_type || that_present_type) { + if (!(this_present_type && that_present_type)) + return false; + if (!this.type.equals(that.type)) + return false; + } + + boolean this_present_writePointer = true; + boolean that_present_writePointer = true; + if (this_present_writePointer || that_present_writePointer) { + if (!(this_present_writePointer && that_present_writePointer)) + return false; + if (this.writePointer != that.writePointer) + return false; + } + + boolean this_present_checkpointWritePointers = true && this.isSetCheckpointWritePointers(); + boolean that_present_checkpointWritePointers = true && that.isSetCheckpointWritePointers(); + if (this_present_checkpointWritePointers || that_present_checkpointWritePointers) { + if (!(this_present_checkpointWritePointers && that_present_checkpointWritePointers)) + return false; + if (!this.checkpointWritePointers.equals(that.checkpointWritePointers)) + return false; + } + + boolean this_present_visibilityLevel = true && this.isSetVisibilityLevel(); + boolean that_present_visibilityLevel = true && that.isSetVisibilityLevel(); + if (this_present_visibilityLevel || that_present_visibilityLevel) { + if (!(this_present_visibilityLevel && that_present_visibilityLevel)) + return false; + if (!this.visibilityLevel.equals(that.visibilityLevel)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(TTransaction other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + TTransaction typedOther = (TTransaction)other; + + lastComparison = Boolean.valueOf(isSetTransactionId()).compareTo(typedOther.isSetTransactionId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTransactionId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transactionId, typedOther.transactionId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetReadPointer()).compareTo(typedOther.isSetReadPointer()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReadPointer()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.readPointer, typedOther.readPointer); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInvalids()).compareTo(typedOther.isSetInvalids()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInvalids()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.invalids, typedOther.invalids); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInProgress()).compareTo(typedOther.isSetInProgress()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInProgress()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inProgress, typedOther.inProgress); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFirstShort()).compareTo(typedOther.isSetFirstShort()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFirstShort()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstShort, typedOther.firstShort); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetWritePointer()).compareTo(typedOther.isSetWritePointer()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetWritePointer()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writePointer, typedOther.writePointer); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCheckpointWritePointers()).compareTo(typedOther.isSetCheckpointWritePointers()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCheckpointWritePointers()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.checkpointWritePointers, typedOther.checkpointWritePointers); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetVisibilityLevel()).compareTo(typedOther.isSetVisibilityLevel()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetVisibilityLevel()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.visibilityLevel, typedOther.visibilityLevel); + 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 { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TTransaction("); + boolean first = true; + + sb.append("transactionId:"); + sb.append(this.transactionId); + first = false; + if (!first) sb.append(", "); + sb.append("readPointer:"); + sb.append(this.readPointer); + first = false; + if (!first) sb.append(", "); + sb.append("invalids:"); + if (this.invalids == null) { + sb.append("null"); + } else { + sb.append(this.invalids); + } + first = false; + if (!first) sb.append(", "); + sb.append("inProgress:"); + if (this.inProgress == null) { + sb.append("null"); + } else { + sb.append(this.inProgress); + } + first = false; + if (!first) sb.append(", "); + sb.append("firstShort:"); + sb.append(this.firstShort); + first = false; + if (!first) sb.append(", "); + sb.append("type:"); + if (this.type == null) { + sb.append("null"); + } else { + sb.append(this.type); + } + first = false; + if (!first) sb.append(", "); + sb.append("writePointer:"); + sb.append(this.writePointer); + first = false; + if (!first) sb.append(", "); + sb.append("checkpointWritePointers:"); + if (this.checkpointWritePointers == null) { + sb.append("null"); + } else { + sb.append(this.checkpointWritePointers); + } + first = false; + if (!first) sb.append(", "); + sb.append("visibilityLevel:"); + if (this.visibilityLevel == null) { + sb.append("null"); + } else { + sb.append(this.visibilityLevel); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + 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_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); + } + } + + private static class TTransactionStandardSchemeFactory implements SchemeFactory { + public TTransactionStandardScheme getScheme() { + return new TTransactionStandardScheme(); + } + } + + private static class TTransactionStandardScheme extends StandardScheme<TTransaction> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TTransaction 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: // TRANSACTION_ID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.transactionId = iprot.readI64(); + struct.setTransactionIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // READ_POINTER + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.readPointer = iprot.readI64(); + struct.setReadPointerIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // INVALIDS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); + struct.invalids = new ArrayList<Long>(_list0.size); + for (int _i1 = 0; _i1 < _list0.size; ++_i1) + { + long _elem2; // required + _elem2 = iprot.readI64(); + struct.invalids.add(_elem2); + } + iprot.readListEnd(); + } + struct.setInvalidsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // IN_PROGRESS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list3 = iprot.readListBegin(); + struct.inProgress = new ArrayList<Long>(_list3.size); + for (int _i4 = 0; _i4 < _list3.size; ++_i4) + { + long _elem5; // required + _elem5 = iprot.readI64(); + struct.inProgress.add(_elem5); + } + iprot.readListEnd(); + } + struct.setInProgressIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // FIRST_SHORT + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.firstShort = iprot.readI64(); + struct.setFirstShortIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.type = TTransactionType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // WRITE_POINTER + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.writePointer = iprot.readI64(); + struct.setWritePointerIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // CHECKPOINT_WRITE_POINTERS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list6 = iprot.readListBegin(); + struct.checkpointWritePointers = new ArrayList<Long>(_list6.size); + for (int _i7 = 0; _i7 < _list6.size; ++_i7) + { + long _elem8; // required + _elem8 = iprot.readI64(); + struct.checkpointWritePointers.add(_elem8); + } + iprot.readListEnd(); + } + struct.setCheckpointWritePointersIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // VISIBILITY_LEVEL + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.visibilityLevel = TVisibilityLevel.findByValue(iprot.readI32()); + struct.setVisibilityLevelIsSet(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(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, TTransaction struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC); + oprot.writeI64(struct.transactionId); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(READ_POINTER_FIELD_DESC); + oprot.writeI64(struct.readPointer); + oprot.writeFieldEnd(); + if (struct.invalids != null) { + oprot.writeFieldBegin(INVALIDS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.invalids.size())); + for (long _iter9 : struct.invalids) + { + oprot.writeI64(_iter9); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.inProgress != null) { + oprot.writeFieldBegin(IN_PROGRESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.inProgress.size())); + for (long _iter10 : struct.inProgress) + { + oprot.writeI64(_iter10); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(FIRST_SHORT_FIELD_DESC); + oprot.writeI64(struct.firstShort); + oprot.writeFieldEnd(); + if (struct.type != null) { + oprot.writeFieldBegin(TYPE_FIELD_DESC); + oprot.writeI32(struct.type.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(WRITE_POINTER_FIELD_DESC); + oprot.writeI64(struct.writePointer); + oprot.writeFieldEnd(); + if (struct.checkpointWritePointers != null) { + oprot.writeFieldBegin(CHECKPOINT_WRITE_POINTERS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, struct.checkpointWritePointers.size())); + for (long _iter11 : struct.checkpointWritePointers) + { + oprot.writeI64(_iter11); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.visibilityLevel != null) { + oprot.writeFieldBegin(VISIBILITY_LEVEL_FIELD_DESC); + oprot.writeI32(struct.visibilityLevel.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TTransactionTupleSchemeFactory implements SchemeFactory { + public TTransactionTupleScheme getScheme() { + return new TTransactionTupleScheme(); + } + } + + private static class TTransactionTupleScheme extends TupleScheme<TTransaction> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTransactionId()) { + optionals.set(0); + } + if (struct.isSetReadPointer()) { + optionals.set(1); + } + if (struct.isSetInvalids()) { + optionals.set(2); + } + if (struct.isSetInProgress()) { + optionals.set(3); + } + if (struct.isSetFirstShort()) { + optionals.set(4); + } + if (struct.isSetType()) { + optionals.set(5); + } + if (struct.isSetWritePointer()) { + optionals.set(6); + } + if (struct.isSetCheckpointWritePointers()) { + optionals.set(7); + } + if (struct.isSetVisibilityLevel()) { + optionals.set(8); + } + oprot.writeBitSet(optionals, 9); + if (struct.isSetTransactionId()) { + oprot.writeI64(struct.transactionId); + } + if (struct.isSetReadPointer()) { + oprot.writeI64(struct.readPointer); + } + if (struct.isSetInvalids()) { + { + oprot.writeI32(struct.invalids.size()); + for (long _iter12 : struct.invalids) + { + oprot.writeI64(_iter12); + } + } + } + if (struct.isSetInProgress()) { + { + oprot.writeI32(struct.inProgress.size()); + for (long _iter13 : struct.inProgress) + { + oprot.writeI64(_iter13); + } + } + } + if (struct.isSetFirstShort()) { + oprot.writeI64(struct.firstShort); + } + if (struct.isSetType()) { + oprot.writeI32(struct.type.getValue()); + } + if (struct.isSetWritePointer()) { + oprot.writeI64(struct.writePointer); + } + if (struct.isSetCheckpointWritePointers()) { + { + oprot.writeI32(struct.checkpointWritePointers.size()); + for (long _iter14 : struct.checkpointWritePointers) + { + oprot.writeI64(_iter14); + } + } + } + if (struct.isSetVisibilityLevel()) { + oprot.writeI32(struct.visibilityLevel.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(9); + if (incoming.get(0)) { + struct.transactionId = iprot.readI64(); + struct.setTransactionIdIsSet(true); + } + if (incoming.get(1)) { + struct.readPointer = iprot.readI64(); + struct.setReadPointerIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32()); + struct.invalids = new ArrayList<Long>(_list15.size); + for (int _i16 = 0; _i16 < _list15.size; ++_i16) + { + long _elem17; // required + _elem17 = iprot.readI64(); + struct.invalids.add(_elem17); + } + } + struct.setInvalidsIsSet(true); + } + if (incoming.get(3)) { + { + org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32()); + struct.inProgress = new ArrayList<Long>(_list18.size); + for (int _i19 = 0; _i19 < _list18.size; ++_i19) + { + long _elem20; // required + _elem20 = iprot.readI64(); + struct.inProgress.add(_elem20); + } + } + struct.setInProgressIsSet(true); + } + if (incoming.get(4)) { + struct.firstShort = iprot.readI64(); + struct.setFirstShortIsSet(true); + } + if (incoming.get(5)) { + struct.type = TTransactionType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); + } + if (incoming.get(6)) { + struct.writePointer = iprot.readI64(); + struct.setWritePointerIsSet(true); + } + if (incoming.get(7)) { + { + org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I64, iprot.readI32()); + struct.checkpointWritePointers = new ArrayList<Long>(_list21.size); + for (int _i22 = 0; _i22 < _list21.size; ++_i22) + { + long _elem23; // required + _elem23 = iprot.readI64(); + struct.checkpointWritePointers.add(_elem23); + } + } + struct.setCheckpointWritePointersIsSet(true); + } + if (incoming.get(8)) { + struct.visibilityLevel = TVisibilityLevel.findByValue(iprot.readI32()); + struct.setVisibilityLevelIsSet(true); + } + } + } + +} +
