/** * 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())); } }
@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); } }
hash = (37 * hash) + OFFSET_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getOffset());
/** * 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()); } } }
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()); } } }