public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (streamInfo_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getStreamInfo()); } if (txnId_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getTxnId()); } if (lease_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, lease_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasStreamInfo()) { hash = (37 * hash) + STREAMINFO_FIELD_NUMBER; hash = (53 * hash) + getStreamInfo().hashCode(); } if (hasTxnId()) { hash = (37 * hash) + TXNID_FIELD_NUMBER; hash = (53 * hash) + getTxnId().hashCode(); } hash = (37 * hash) + LEASE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getLease()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest buildPartial() { io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest result = new io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest(this); if (streamInfoBuilder_ == null) { result.streamInfo_ = streamInfo_; } else { result.streamInfo_ = streamInfoBuilder_.build(); } if (txnIdBuilder_ == null) { result.txnId_ = txnId_; } else { result.txnId_ = txnIdBuilder_.build(); } result.lease_ = lease_; onBuilt(); return result; }
@io.grpc.stub.annotations.RpcMethod( fullMethodName = SERVICE_NAME + '/' + "pingTransaction", requestType = io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest.class, responseType = io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor<io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest, io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus> getPingTransactionMethod() { io.grpc.MethodDescriptor<io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest, io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus> getPingTransactionMethod; if ((getPingTransactionMethod = ControllerServiceGrpc.getPingTransactionMethod) == null) { synchronized (ControllerServiceGrpc.class) { if ((getPingTransactionMethod = ControllerServiceGrpc.getPingTransactionMethod) == null) { ControllerServiceGrpc.getPingTransactionMethod = getPingTransactionMethod = io.grpc.MethodDescriptor.<io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest, io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName( "io.pravega.controller.stream.api.grpc.v1.ControllerService", "pingTransaction")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus.getDefaultInstance())) .setSchemaDescriptor(new ControllerServiceMethodDescriptorSupplier("pingTransaction")) .build(); } } } return getPingTransactionMethod; }
@Override public CompletableFuture<Void> pingTransaction(Stream stream, UUID txId, long lease) { Exceptions.checkNotClosed(closed.get(), this); long traceId = LoggerHelpers.traceEnter(log, "pingTransaction", stream, txId, lease); final CompletableFuture<PingTxnStatus> result = this.retryConfig.runAsync(() -> { RPCAsyncCallback<PingTxnStatus> callback = new RPCAsyncCallback<>(traceId, "pingTransaction"); client.pingTransaction(PingTxnRequest.newBuilder().setStreamInfo( ModelHelper.createStreamInfo(stream.getScope(), stream.getStreamName())) .setTxnId(ModelHelper.decode(txId)) .setLease(lease).build(), callback); return callback.getFuture(); }, this.executor); return Futures.toVoidExpecting(result, PingTxnStatus.newBuilder().setStatus(PingTxnStatus.Status.OK).build(), PingFailedException::new) .whenComplete((x, e) -> { if (e != null) { log.warn("pingTransaction failed: ", e); } LoggerHelpers.traceLeave(log, "pingTransaction", traceId); }); }
@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; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest getDefaultInstanceForType() { return io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest.getDefaultInstance(); }
public Builder mergeFrom(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest other) { if (other == io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest.getDefaultInstance()) return this; if (other.hasStreamInfo()) { mergeStreamInfo(other.getStreamInfo()); } if (other.hasTxnId()) { mergeTxnId(other.getTxnId()); } if (other.getLease() != 0L) { setLease(other.getLease()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (streamInfo_ != null) { output.writeMessage(1, getStreamInfo()); } if (txnId_ != null) { output.writeMessage(2, getTxnId()); } if (lease_ != 0L) { output.writeInt64(3, lease_); } unknownFields.writeTo(output); }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.StreamInfo streamInfo = 1;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.StreamInfoOrBuilder getStreamInfoOrBuilder() { return getStreamInfo(); }
@Override public void pingTransaction(PingTxnRequest request, StreamObserver<PingTxnStatus> responseObserver) { log.info("pingTransaction called for stream {}/{}, txnId={}", request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), request.getTxnId()); authenticateExecuteAndProcessResults(() -> this.authHelper.checkAuthorization(request.getStreamInfo().getScope() + "/" + request.getStreamInfo().getStream(), AuthHandler.Permissions.READ), delegationToken -> controllerService.pingTransaction(request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), request.getTxnId(), request.getLease()), responseObserver); }
/** * <code>.io.pravega.controller.stream.api.grpc.v1.TxnId txnId = 2;</code> */ public io.pravega.controller.stream.api.grpc.v1.Controller.TxnIdOrBuilder getTxnIdOrBuilder() { return getTxnId(); }
@Override public void pingTransaction(PingTxnRequest request, StreamObserver<PingTxnStatus> responseObserver) { if (request.getStreamInfo().getStream().equals("stream1")) { responseObserver.onNext(PingTxnStatus.newBuilder().setStatus(PingTxnStatus.Status.OK).build()); responseObserver.onCompleted(); } else { responseObserver.onError(Status.INTERNAL.withDescription("Server error").asRuntimeException()); } }