result = result && (hasType() == other.hasType()); if (hasType()) { result = result && type_ == other.type_; result = result && (hasId() == other.hasId()); if (hasId()) { result = result && (getId() == other.getId()); result = result && (hasOffset() == other.hasOffset()); if (hasOffset()) { result = result && (getOffset() == other.getOffset()); result = result && (hasTier() == other.hasTier()); if (hasTier()) { result = result && (getTier() == other.getTier()); result = result && (hasFlush() == other.hasFlush()); if (hasFlush()) { result = result && (getFlush() == other.getFlush()); result = result && (hasCreateUfsFileOptions() == other.hasCreateUfsFileOptions()); if (hasCreateUfsFileOptions()) { result = result && getCreateUfsFileOptions() .equals(other.getCreateUfsFileOptions());
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
/** * @param request block request in proto */ BlockWriteRequest(alluxio.grpc.WriteRequest request) { super(request); mTier = request.getCommand().getTier(); if (request.getCommand().hasCreateUfsBlockOptions()) { mCreateUfsBlockOptions = request.getCommand().getCreateUfsBlockOptions(); } else { mCreateUfsBlockOptions = null; } }
@Override protected void handleCommand(WriteRequestCommand command, BlockWriteRequestContext context) throws Exception { if (command.hasCreateUfsBlockOptions() && command.getOffset() == 0 && command.getCreateUfsBlockOptions().hasBytesInBlockStore()) { long ufsFallbackInitBytes = command.getCreateUfsBlockOptions().getBytesInBlockStore(); context.setPos(context.getPos() + ufsFallbackInitBytes); initUfsFallback(context); } }
/** * Validates the read request sent. * * @param request the request * @param offset the offset */ private void validateWriteRequest(WriteRequest request, long offset) { if (request.hasCommand()) { assertEquals(RequestType.UFS_FALLBACK_BLOCK, request.getCommand().getType()); assertEquals(BLOCK_ID, request.getCommand().getId()); assertEquals(offset, request.getCommand().getOffset()); assertTrue(request.getCommand().hasCreateUfsBlockOptions()); assertEquals(MOUNT_ID, request.getCommand().getCreateUfsBlockOptions().getMountId()); } else { assertTrue(request.hasChunk()); } } }
/** * Notifies the server UFS fallback endpoint to start writing a new block by resuming the given * number of bytes from block store. * * @param pos number of bytes already written to block store */ public void writeFallbackInitRequest(long pos) throws IOException { Preconditions.checkState(mPartialRequest.getType() == RequestType.UFS_FALLBACK_BLOCK); Protocol.CreateUfsBlockOptions ufsBlockOptions = mPartialRequest.getCreateUfsBlockOptions() .toBuilder().setBytesInBlockStore(pos).build(); WriteRequest writeRequest = WriteRequest.newBuilder().setCommand( mPartialRequest.toBuilder().setOffset(0).setCreateUfsBlockOptions(ufsBlockOptions)) .build(); mPosToQueue = pos; mStream.send(writeRequest, mDataTimeoutMs); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeEnum(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, id_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, offset_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(4, tier_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBool(5, flush_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeMessage(6, getCreateUfsFileOptions()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeMessage(7, getCreateUfsBlockOptions()); } unknownFields.writeTo(output); }
/** * Validates the read request sent. * * @param request the request * @param offset the offset */ private void validateWriteRequest(WriteRequest request, long offset) { if (request.hasCommand()) { Assert.assertEquals(BLOCK_ID, request.getCommand().getId()); Assert.assertEquals(offset, request.getCommand().getOffset()); } else { Assert.assertTrue(request.hasChunk()); } } }
/** * Validates a block write request. * * @param request the block write request * @throws InvalidArgumentException if the write request is invalid */ @GuardedBy("mLock") private void validateWriteRequest(alluxio.grpc.WriteRequest request) throws InvalidArgumentException { if (request.hasCommand() && request.getCommand().hasOffset() && request.getCommand().getOffset() != mContext.getPos()) { throw new InvalidArgumentException(String.format( "Offsets do not match [received: %d, expected: %d].", request.getCommand().getOffset(), mContext.getPos())); } }
private AbstractWriteHandler createWriterHandler(alluxio.grpc.WriteRequest request) { switch (request.getCommand().getType()) { case ALLUXIO_BLOCK: return new BlockWriteHandler(mWorkerProcess.getWorker(BlockWorker.class), mResponseObserver); case UFS_FILE: return new UfsFileWriteHandler(mWorkerProcess.getUfsManager(), mResponseObserver); case UFS_FALLBACK_BLOCK: return new UfsFallbackBlockWriteHandler( mWorkerProcess.getWorker(BlockWorker.class), mWorkerProcess.getUfsManager(), mResponseObserver); default: throw new IllegalArgumentException(String.format("Invalid request type %s", request.getCommand().getType().name())); } }
validateWriteRequest(writeRequest, pos); if (writeRequest.hasCommand() && writeRequest.getCommand().getCreateUfsBlockOptions().hasBytesInBlockStore()) { pos += writeRequest.getCommand().getCreateUfsBlockOptions().getBytesInBlockStore(); continue;
WriteRequestCommand.newBuilder().setId(id).setTier(options.getWriteTier()).setType(type); if (type == RequestType.UFS_FILE) { Protocol.CreateUfsFileOptions ufsFileOptions = mStream = new GrpcBlockingStream<>(mClient::writeBlock, mWriterBufferSizeMessages, address.toString()); mStream.send(WriteRequest.newBuilder().setCommand(mPartialRequest.toBuilder()).build(), mDataTimeoutMs);
WriteRequest(alluxio.grpc.WriteRequest request) { mId = request.getCommand().getId(); mSessionId = IdUtils.createSessionId(); }
/** * <code>optional .alluxio.grpc.block.WriteRequestCommand command = 1;</code> */ public Builder mergeCommand(alluxio.grpc.WriteRequestCommand value) { if (commandBuilder_ == null) { if (valueCase_ == 1 && value_ != alluxio.grpc.WriteRequestCommand.getDefaultInstance()) { value_ = alluxio.grpc.WriteRequestCommand.newBuilder((alluxio.grpc.WriteRequestCommand) value_) .mergeFrom(value).buildPartial(); } else { value_ = value; } onChanged(); } else { if (valueCase_ == 1) { commandBuilder_.mergeFrom(value); } commandBuilder_.setMessage(value); } valueCase_ = 1; return this; } /**
UfsFileWriteRequest(alluxio.grpc.WriteRequest request) { super(request); mUfsPath = request.getCommand().getCreateUfsFileOptions().getUfsPath(); mCreateUfsFileOptions = request.getCommand().getCreateUfsFileOptions(); }
if (writeRequest.hasCommand()) { WriteRequestCommand command = writeRequest.getCommand(); if (command.getFlush()) { flush(); } else {
.computeMessageSize(6, getCreateUfsFileOptions()); .computeMessageSize(7, getCreateUfsBlockOptions());
hash = (19 * hash) + getDescriptor().hashCode(); if (hasType()) { hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; if (hasId()) { hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getId()); if (hasOffset()) { hash = (37 * hash) + OFFSET_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getOffset()); if (hasTier()) { hash = (37 * hash) + TIER_FIELD_NUMBER; hash = (53 * hash) + getTier(); if (hasFlush()) { hash = (37 * hash) + FLUSH_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getFlush()); if (hasCreateUfsFileOptions()) { hash = (37 * hash) + CREATE_UFS_FILE_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getCreateUfsFileOptions().hashCode(); if (hasCreateUfsBlockOptions()) {
public Builder mergeFrom(alluxio.grpc.WriteRequestCommand other) { if (other == alluxio.grpc.WriteRequestCommand.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasId()) { setId(other.getId()); } if (other.hasOffset()) { setOffset(other.getOffset()); } if (other.hasTier()) { setTier(other.getTier()); } if (other.hasFlush()) { setFlush(other.getFlush()); } if (other.hasCreateUfsFileOptions()) { mergeCreateUfsFileOptions(other.getCreateUfsFileOptions()); } if (other.hasCreateUfsBlockOptions()) { mergeCreateUfsBlockOptions(other.getCreateUfsBlockOptions()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }