xintongsong commented on code in PR #22851:
URL: https://github.com/apache/flink/pull/22851#discussion_r1250092923
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/common/TieredStorageUtils.java:
##########
@@ -49,4 +60,61 @@ public static void setBufferWithHeader(
bufferWithHeaders[index] = header;
bufferWithHeaders[index + 1] = buffer.getNioBufferReadable();
}
+
+ public static void writeBuffers(
+ WritableByteChannel writeChannel, long expectedBytes, ByteBuffer[]
bufferWithHeaders)
+ throws IOException {
+ int writeSize = 0;
+ for (ByteBuffer bufferWithHeader : bufferWithHeaders) {
+ writeSize += writeChannel.write(bufferWithHeader);
+ }
+ checkState(writeSize == expectedBytes);
+ }
+
+ public static String getSubpartitionPath(
+ String basePath, TieredStoragePartitionId partitionId, int
subpartitionId) {
+ while (basePath.endsWith("/") && basePath.length() > 1) {
+ basePath = basePath.substring(0, basePath.length() - 1);
+ }
+ return String.format(
+ "%s/%s/%s",
+ basePath, TieredStorageIdMappingUtils.convertId(partitionId),
subpartitionId);
+ }
+
+ public static Path getSegmentPath(
Review Comment:
`setBufferWithHeader` might be private.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]