if (!getSealedSegmentsList().isEmpty()) { size += 1; size += com.google.protobuf.CodedOutputStream
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); }
@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; }
@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; }
@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); }