/** * Returns TxnId object instance for a given transaction with UUID. * * @param txnId UUID * @return Instance of TxnId. */ public static final TxnId decode(final UUID txnId) { Preconditions.checkNotNull(txnId, "txnId"); return TxnId.newBuilder() .setHighBits(txnId.getMostSignificantBits()) .setLowBits(txnId.getLeastSignificantBits()) .build(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + HIGHBITS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getHighBits()); hash = (37 * hash) + LOWBITS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getLowBits()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnIdOrBuilder getTxnIdOrBuilder() { if (txnIdBuilder_ != null) { return txnIdBuilder_.getMessageOrBuilder(); } else { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest other = (io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest) obj; boolean result = true; result = result && (hasStreamInfo() == other.hasStreamInfo()); if (hasStreamInfo()) { result = result && getStreamInfo() .equals(other.getStreamInfo()); } result = result && (hasTxnId() == other.hasTxnId()); if (hasTxnId()) { result = result && getTxnId() .equals(other.getTxnId()); } result = result && (getLease() == other.getLease()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse other = (io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse) obj; boolean result = true; result = result && (hasTxnId() == other.hasTxnId()); if (hasTxnId()) { result = result && getTxnId() .equals(other.getTxnId()); } result = result && getActiveSegmentsList() .equals(other.getActiveSegmentsList()); result = result && getDelegationToken() .equals(other.getDelegationToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest other = (io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest) obj; boolean result = true; result = result && (hasStreamInfo() == other.hasStreamInfo()); if (hasStreamInfo()) { result = result && getStreamInfo() .equals(other.getStreamInfo()); } result = result && (hasTxnId() == other.hasTxnId()); if (hasTxnId()) { result = result && getTxnId() .equals(other.getTxnId()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@Override public void createTransaction(CreateTxnRequest request, StreamObserver<Controller.CreateTxnResponse> responseObserver) { Controller.CreateTxnResponse.Builder builder = Controller.CreateTxnResponse.newBuilder(); if (request.getStreamInfo().getStream().equals("stream1")) { builder.setTxnId(TxnId.newBuilder().setHighBits(11L).setLowBits(22L).build()); builder.addActiveSegments(ModelHelper.createSegmentRange("scope1", "stream1", 0, 0.0, 0.5)); builder.addActiveSegments(ModelHelper.createSegmentRange("scope1", "stream1", 1, 0.5, 1.0)); responseObserver.onNext(builder.build()); responseObserver.onCompleted(); } else if (request.getStreamInfo().getStream().equals("stream2")) { builder.addActiveSegments(ModelHelper.createSegmentRange("scope1", "stream2", 0, 0.0, 1.0)); builder.setTxnId(TxnId.newBuilder().setHighBits(33L).setLowBits(44L).build()); responseObserver.onNext(builder.build()); responseObserver.onCompleted(); } else { responseObserver.onError(Status.INTERNAL.withDescription("Server error").asRuntimeException()); } }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public Builder mergeTxnId(io.pravega.controller.stream.api.grpc.v1.Controller.TxnId value) { if (txnIdBuilder_ == null) { if (txnId_ != null) { txnId_ = io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.newBuilder(txnId_).mergeFrom(value).buildPartial(); } else { txnId_ = value; } onChanged(); } else { txnIdBuilder_.mergeFrom(value); } return this; } /**
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 1;</code> */ public Builder mergeTxnId(io.pravega.controller.stream.api.grpc.v1.Controller.TxnId value) { if (txnIdBuilder_ == null) { if (txnId_ != null) { txnId_ = io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.newBuilder(txnId_).mergeFrom(value).buildPartial(); } else { txnId_ = value; } onChanged(); } else { txnIdBuilder_.mergeFrom(value); } return this; } /**
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public Builder mergeTxnId(io.pravega.controller.stream.api.grpc.v1.Controller.TxnId value) { if (txnIdBuilder_ == null) { if (txnId_ != null) { txnId_ = io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.newBuilder(txnId_).mergeFrom(value).buildPartial(); } else { txnId_ = value; } onChanged(); } else { txnIdBuilder_.mergeFrom(value); } return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.pravega.controller.stream.api.grpc.v1.Controller.TxnId)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.TxnId other = (io.pravega.controller.stream.api.grpc.v1.Controller.TxnId) obj; boolean result = true; result = result && (getHighBits() == other.getHighBits()); result = result && (getLowBits() == other.getLowBits()); result = result && unknownFields.equals(other.unknownFields); return result; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public io.pravega.controller.stream.api.grpc.v1.Controller.TxnId getDefaultInstanceForType() { return io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance(); }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnIdOrBuilder getTxnIdOrBuilder() { if (txnIdBuilder_ != null) { return txnIdBuilder_.getMessageOrBuilder(); } else { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } } /**
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnId getTxnId() { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } /**
@Test(timeout = 10000) public void testUnknownTxnPingSuccess() throws InterruptedException { UUID txnId = streamStore.generateTransactionId(SCOPE, STREAM, null, executor).join(); VersionedTransactionData txData = streamStore.createTransaction(SCOPE, STREAM, txnId, LEASE, 10 * LEASE, null, executor).join(); TxnId tx = TxnId.newBuilder() .setHighBits(txnId.getMostSignificantBits()) .setLowBits(txnId.getLeastSignificantBits()) .build(); controllerService.pingTransaction(SCOPE, STREAM, tx, LEASE); TxnStatus status = streamStore.transactionStatus(SCOPE, STREAM, txData.getId(), null, executor).join(); Assert.assertEquals(TxnStatus.OPEN, status); }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnId getTxnId() { if (txnIdBuilder_ == null) { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } else { return txnIdBuilder_.getMessage(); } } /**
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 1;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnIdOrBuilder getTxnIdOrBuilder() { if (txnIdBuilder_ != null) { return txnIdBuilder_.getMessageOrBuilder(); } else { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } } /**
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 1;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnId getTxnId() { if (txnIdBuilder_ == null) { return txnId_ == null ? io.pravega.controller.stream.api.grpc.v1.Controller.TxnId.getDefaultInstance() : txnId_; } else { return txnIdBuilder_.getMessage(); } } /**
/** * Returns UUID of transaction with given TxnId. * * @param txnId The Transaction Id. * @return UUID of the transaction. */ public static final UUID encode(final TxnId txnId) { Preconditions.checkNotNull(txnId, "txnId"); return new UUID(txnId.getHighBits(), txnId.getLowBits()); }