public OmidTransactionContext(byte[] txnBytes) throws InvalidProtocolBufferException { this(); if (txnBytes != null && txnBytes.length > 0) { TSOProto.Transaction transaction = TSOProto.Transaction.parseFrom(txnBytes); tx = new HBaseTransaction(transaction.getTimestamp(), transaction.getEpoch(), new HashSet<HBaseCellId>(), new HashSet<HBaseCellId>(), null, tm.isLowLatency()); } else { tx = null; } }
@Override public byte[] encodeTransaction() throws SQLException { assert(tx != null); TSOProto.Transaction.Builder transactionBuilder = TSOProto.Transaction.newBuilder(); transactionBuilder.setTimestamp(tx.getTransactionId()); transactionBuilder.setEpoch(tx.getEpoch()); byte[] encodedTxBytes = transactionBuilder.build().toByteArray(); // Add code of TransactionProvider at end of byte array encodedTxBytes = Arrays.copyOf(encodedTxBytes, encodedTxBytes.length + 1); encodedTxBytes[encodedTxBytes.length - 1] = getProvider().getCode(); return encodedTxBytes; }
public org.apache.omid.proto.TSOProto.Transaction buildPartial() { org.apache.omid.proto.TSOProto.Transaction result = new org.apache.omid.proto.TSOProto.Transaction(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.timestamp_ = timestamp_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.readTimestamp_ = readTimestamp_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.visibilityLevel_ = visibilityLevel_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.epoch_ = epoch_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, timestamp_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, readTimestamp_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, visibilityLevel_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, epoch_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
public Builder toBuilder() { return newBuilder(this); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.omid.proto.TSOProto.Transaction prototype) {
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, timestamp_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, readTimestamp_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, visibilityLevel_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, epoch_); } getUnknownFields().writeTo(output); }
public org.apache.omid.proto.TSOProto.Transaction getDefaultInstanceForType() { return org.apache.omid.proto.TSOProto.Transaction.getDefaultInstance(); }
public Builder mergeFrom(org.apache.omid.proto.TSOProto.Transaction other) { if (other == org.apache.omid.proto.TSOProto.Transaction.getDefaultInstance()) return this; if (other.hasTimestamp()) { setTimestamp(other.getTimestamp()); } if (other.hasReadTimestamp()) { setReadTimestamp(other.getReadTimestamp()); } if (other.hasVisibilityLevel()) { setVisibilityLevel(other.getVisibilityLevel()); } if (other.hasEpoch()) { setEpoch(other.getEpoch()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public static Builder newBuilder(org.apache.omid.proto.TSOProto.Transaction prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }