private boolean uploadWithRetries(BlobId blobId, ByteBuffer messageBuf, long bufferSize,
      CloudBlobMetadata blobMetadata) throws CloudStorageException {
    return requestAgent.doWithRetries(() -> {
      // Note: reset buffer and input stream each time through the loop
      messageBuf.rewind();
      InputStream uploadInputStream = new ByteBufferInputStream(messageBuf);
      return cloudDestination.uploadBlob(blobId, bufferSize, blobMetadata, uploadInputStream);
    }, "Upload", partitionId.toPathString());
  }
Upload the supplied message buffer to a blob in the cloud destination.
@param blobId the {@link BlobId}.
@param messageBuf the byte buffer to upload.
@param bufferSize the size of the buffer.
@param blobMetadata the {@link CloudBlobMetadata} for the blob.
@return boolean indicating if the upload was completed.
@throws CloudStorageException if the upload failed.
ambry-cloud/src/main/java/com/github/ambry/cloud/CloudBlobStore.java