public Builder mergeFrom(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest other) { if (other == io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest.getDefaultInstance()) return this; if (other.hasStreamInfo()) { mergeStreamInfo(other.getStreamInfo()); if (other.getScaleTimestamp() != 0L) { setScaleTimestamp(other.getScaleTimestamp());
private CompletableFuture<ScaleResponse> startScaleInternal(final Stream stream, final List<Long> sealedSegments, final Map<Double, Double> newKeyRanges, String method, long requestId) { Preconditions.checkNotNull(stream, "stream"); Preconditions.checkNotNull(sealedSegments, "sealedSegments"); Preconditions.checkNotNull(newKeyRanges, "newKeyRanges"); final CompletableFuture<ScaleResponse> result = this.retryConfig.runAsync(() -> { RPCAsyncCallback<ScaleResponse> callback = new RPCAsyncCallback<>(requestId, method); long scaleTimestamp = System.currentTimeMillis(); new ControllerClientTagger(client) .withTag(requestId, method, stream.getScope(), stream.getStreamName(), String.valueOf(scaleTimestamp)) .scale(ScaleRequest.newBuilder() .setStreamInfo(ModelHelper.createStreamInfo(stream.getScope(), stream.getStreamName())) .addAllSealedSegments(sealedSegments) .addAllNewKeyRanges(newKeyRanges.entrySet().stream() .map(x -> ScaleRequest.KeyRangeEntry.newBuilder() .setStart(x.getKey()).setEnd(x.getValue()).build()) .collect(Collectors.toList())) .setScaleTimestamp(scaleTimestamp) .build(), callback); return callback.getFuture(); }, this.executor); 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.ScaleRequest)) { return super.equals(obj); } io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest other = (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest) obj; boolean result = true; result = result && (hasStreamInfo() == other.hasStreamInfo()); if (hasStreamInfo()) { result = result && getStreamInfo() .equals(other.getStreamInfo()); } result = result && getSealedSegmentsList() .equals(other.getSealedSegmentsList()); result = result && getNewKeyRangesList() .equals(other.getNewKeyRangesList()); result = result && (getScaleTimestamp() == other.getScaleTimestamp()); result = result && unknownFields.equals(other.unknownFields); return result; }
keyRanges.put(0.75, 1.0); final ScaleRequest scaleRequest = ScaleRequest.newBuilder() .setStreamInfo(ModelHelper.createStreamInfo(SCOPE1, STREAM1)) .setScaleTimestamp(createTime + 20)
if (streamInfo_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getStreamInfo()); if (!getSealedSegmentsList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream
public io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest buildPartial() { io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest result = new io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (streamInfoBuilder_ == null) { result.streamInfo_ = streamInfo_; } else { result.streamInfo_ = streamInfoBuilder_.build(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { sealedSegments_ = java.util.Collections.unmodifiableList(sealedSegments_); bitField0_ = (bitField0_ & ~0x00000002); } result.sealedSegments_ = sealedSegments_; if (newKeyRangesBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004)) { newKeyRanges_ = java.util.Collections.unmodifiableList(newKeyRanges_); bitField0_ = (bitField0_ & ~0x00000004); } result.newKeyRanges_ = newKeyRanges_; } else { result.newKeyRanges_ = newKeyRangesBuilder_.build(); } result.scaleTimestamp_ = scaleTimestamp_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@io.grpc.stub.annotations.RpcMethod( fullMethodName = SERVICE_NAME + '/' + "scale", requestType = io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest.class, responseType = io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor<io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest, io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse> getScaleMethod() { io.grpc.MethodDescriptor<io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest, io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse> getScaleMethod; if ((getScaleMethod = ControllerServiceGrpc.getScaleMethod) == null) { synchronized (ControllerServiceGrpc.class) { if ((getScaleMethod = ControllerServiceGrpc.getScaleMethod) == null) { ControllerServiceGrpc.getScaleMethod = getScaleMethod = io.grpc.MethodDescriptor.<io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest, io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName( "io.pravega.controller.stream.api.grpc.v1.ControllerService", "scale")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse.getDefaultInstance())) .setSchemaDescriptor(new ControllerServiceMethodDescriptorSupplier("scale")) .build(); } } } return getScaleMethod; }
@Override public void scale(ScaleRequest request, StreamObserver<ScaleResponse> responseObserver) { if (request.getStreamInfo().getStream().equals("stream1")) { responseObserver.onNext(ScaleResponse.newBuilder() .setStatus(ScaleResponse.ScaleStreamStatus.STARTED) .addSegments(ModelHelper.createSegmentRange("scope1", "stream1", 0, 0.0, 0.5)) .addSegments(ModelHelper.createSegmentRange("scope1", "stream1", 1, 0.5, 1.0)) .setEpoch(0) .build()); responseObserver.onCompleted(); } else { responseObserver.onError(Status.INTERNAL.withDescription("Server error").asRuntimeException()); } }
@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 (getSealedSegmentsCount() > 0) { hash = (37 * hash) + SEALEDSEGMENTS_FIELD_NUMBER; hash = (53 * hash) + getSealedSegmentsList().hashCode(); } if (getNewKeyRangesCount() > 0) { hash = (37 * hash) + NEWKEYRANGES_FIELD_NUMBER; hash = (53 * hash) + getNewKeyRangesList().hashCode(); } hash = (37 * hash) + SCALETIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getScaleTimestamp()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (streamInfo_ != null) { output.writeMessage(1, getStreamInfo()); } if (getSealedSegmentsList().size() > 0) { output.writeUInt32NoTag(18); output.writeUInt32NoTag(sealedSegmentsMemoizedSerializedSize); } for (int i = 0; i < sealedSegments_.size(); i++) { output.writeInt64NoTag(sealedSegments_.get(i)); } for (int i = 0; i < newKeyRanges_.size(); i++) { output.writeMessage(3, newKeyRanges_.get(i)); } if (scaleTimestamp_ != 0L) { output.writeInt64(4, scaleTimestamp_); } unknownFields.writeTo(output); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
@Override public void scale(ScaleRequest request, StreamObserver<ScaleResponse> responseObserver) { RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(requestIdGenerator.get(), "scaleStream", request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), String.valueOf(request.getScaleTimestamp())); log.info(requestTag.getRequestId(), "scale called for stream {}/{}.", request.getStreamInfo().getScope(), request.getStreamInfo().getStream()); authenticateExecuteAndProcessResults(() -> this.authHelper.checkAuthorization(request.getStreamInfo().getScope() + "/" + request.getStreamInfo().getStream(), AuthHandler.Permissions.READ_UPDATE), delegationToken -> controllerService.scale(request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), request.getSealedSegmentsList(), request.getNewKeyRangesList().stream().collect(Collectors.toMap( entry -> entry.getStart(), entry -> entry.getEnd())), request.getScaleTimestamp()), responseObserver); }
public io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest getDefaultInstanceForType() { return io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest.getDefaultInstance(); }
/** * <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(); }