CompletableFuture<Long> writeAsyncTo(CloudWriteChannel writeChannel) {
    ReadableByteChannel readableByteChannel = Channels.newChannel(streamToWrite);
    AtomicLong sizeWritten = new AtomicLong();
    List<CompletableFuture<Void>> operationFutures = new ArrayList<>();
    for (MessageInfo info : streamInfo) {
      operationFutures.add(writeChannel.appendAsyncFrom(readableByteChannel, info.getSize())
          .thenRun(() -> sizeWritten.addAndGet(info.getSize())));
    }
    return CompletableFuture.allOf(operationFutures.toArray(new CompletableFuture<?>[0]))
        .thenApply(unused -> sizeWritten.get());
  }
Write the messages in this set to the given write channel asynchronously
@param writeChannel The write interface to write the messages to
@return a {@link CompletableFuture} that will eventually contain the size in bytes that was written to the
        write interface or the {@link CloudStorageException} if an error occurred
ambry-cloud/src/main/java/com/github/ambry/cloud/CloudMessageFormatWriteSet.java