TanYuxin-tyx commented on code in PR #23255:
URL: https://github.com/apache/flink/pull/23255#discussion_r1319719593
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/file/PartitionFileReader.java:
##########
@@ -78,4 +87,79 @@ long getPriority(
/** Release the {@link PartitionFileReader}. */
void release();
+
+ /** A {@link PartialBuffer} is a part slice of a larger buffer. */
+ class PartialBuffer extends CompositeBuffer {
+
+ public PartialBuffer(BufferHeader bufferHeader) {
+ super(bufferHeader);
+ }
+ }
+
+ /**
+ * A wrapper class of the reading buffer result, including the read
buffers, the hint of
+ * continue reading, and the read progress, etc.
+ */
+ class ReadBufferResult {
+
+ /** The read buffers. */
+ private final List<Buffer> readBuffers;
+
+ /**
+ * A hint to determine whether the caller should continue reading the
following buffers.
+ * Note that this hint is merely a recommendation and not obligatory.
Following the hint
+ * while reading buffers may improve performance.
+ */
+ private final boolean shouldContinueReadHint;
+
+ /** The read progress state. */
+ private final ReadProgress readProgress;
+
+ public ReadBufferResult(
+ List<Buffer> readBuffers,
+ boolean shouldContinueReadHint,
+ ReadProgress readProgress) {
+ this.readBuffers = readBuffers;
+ this.shouldContinueReadHint = shouldContinueReadHint;
+ this.readProgress = readProgress;
+ }
+
+ public List<Buffer> getReadBuffers() {
+ return readBuffers;
+ }
+
+ public boolean shouldContinueReadHint() {
+ return shouldContinueReadHint;
+ }
+
+ public ReadProgress getReadProgress() {
+ return readProgress;
+ }
+ }
+
+ /** The {@link ReadProgress} mainly includes current reading offset, end
of read offset, etc. */
+ class ReadProgress {
Review Comment:
Ok, I extracted it as an interface `ReadProgress` in the
`PartitionFileReader`. And the implementation is in the
`ProducerMergedPartitionFile`.
In addition, I made `ReadProgress` an argument of
`PartitionFileReader#getPriority`.
--
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]