@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 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; } }
private void initFields() { timestampRequest_ = org.apache.omid.proto.TSOProto.TimestampRequest.getDefaultInstance(); commitRequest_ = org.apache.omid.proto.TSOProto.CommitRequest.getDefaultInstance(); handshakeRequest_ = org.apache.omid.proto.TSOProto.HandshakeRequest.getDefaultInstance(); fenceRequest_ = org.apache.omid.proto.TSOProto.FenceRequest.getDefaultInstance(); } private byte memoizedIsInitialized = -1;
@Override public void sendTimestampResponse(long startTimestamp, Channel c) { TSOProto.Response.Builder builder = TSOProto.Response.newBuilder(); TSOProto.TimestampResponse.Builder respBuilder = TSOProto.TimestampResponse.newBuilder(); respBuilder.setStartTimestamp(startTimestamp); builder.setTimestampResponse(respBuilder.build()); c.write(builder.build()); }
public Builder mergeFrom(org.apache.omid.proto.TSOProto.HandshakeRequest other) { if (other == org.apache.omid.proto.TSOProto.HandshakeRequest.getDefaultInstance()) return this; if (other.hasClientCapabilities()) { mergeClientCapabilities(other.getClientCapabilities()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public static Builder newBuilder(org.apache.omid.proto.TSOProto.Capabilities prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
private void initFields() { timestampResponse_ = org.apache.omid.proto.TSOProto.TimestampResponse.getDefaultInstance(); commitResponse_ = org.apache.omid.proto.TSOProto.CommitResponse.getDefaultInstance(); handshakeResponse_ = org.apache.omid.proto.TSOProto.HandshakeResponse.getDefaultInstance(); fenceResponse_ = org.apache.omid.proto.TSOProto.FenceResponse.getDefaultInstance(); } private byte memoizedIsInitialized = -1;
public org.apache.omid.proto.TSOProto.Request build() { org.apache.omid.proto.TSOProto.Request result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.TimestampRequest build() { org.apache.omid.proto.TSOProto.TimestampRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.CommitResponse build() { org.apache.omid.proto.TSOProto.CommitResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.Capabilities build() { org.apache.omid.proto.TSOProto.Capabilities result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public Builder mergeFrom(org.apache.omid.proto.TSOProto.Capabilities other) { if (other == org.apache.omid.proto.TSOProto.Capabilities.getDefaultInstance()) return this; this.mergeUnknownFields(other.getUnknownFields()); return this; }
public org.apache.omid.proto.TSOProto.FenceRequest build() { org.apache.omid.proto.TSOProto.FenceRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.Response build() { org.apache.omid.proto.TSOProto.Response result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.FenceResponse build() { org.apache.omid.proto.TSOProto.FenceResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.HandshakeRequest build() { org.apache.omid.proto.TSOProto.HandshakeRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.HandshakeResponse build() { org.apache.omid.proto.TSOProto.HandshakeResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public org.apache.omid.proto.TSOProto.FenceRequest buildPartial() { org.apache.omid.proto.TSOProto.FenceRequest result = new org.apache.omid.proto.TSOProto.FenceRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tableId_ = tableId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public org.apache.omid.proto.TSOProto.TimestampResponse buildPartial() { org.apache.omid.proto.TSOProto.TimestampResponse result = new org.apache.omid.proto.TSOProto.TimestampResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.startTimestamp_ = startTimestamp_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
public org.apache.omid.proto.TSOProto.Capabilities buildPartial() { org.apache.omid.proto.TSOProto.Capabilities result = new org.apache.omid.proto.TSOProto.Capabilities(this); onBuilt(); return result; }