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); }
.computeMessageSize(7, getCreateUfsBlockOptions());
@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); } }
/** * @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; } }
hash = (53 * hash) + getCreateUfsBlockOptions().hashCode();
/** * 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); }
validateWriteRequest(writeRequest, pos); if (writeRequest.hasCommand() && writeRequest.getCommand().getCreateUfsBlockOptions().hasBytesInBlockStore()) { pos += writeRequest.getCommand().getCreateUfsBlockOptions().getBytesInBlockStore(); continue;
result = result && getCreateUfsBlockOptions() .equals(other.getCreateUfsBlockOptions());
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; }
/** * 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()); } } }