apoorvmittal10 commented on code in PR #19581: URL: https://github.com/apache/kafka/pull/19581#discussion_r2075585304
########## clients/src/main/java/org/apache/kafka/common/record/Records.java: ########## @@ -90,4 +91,18 @@ public interface Records extends TransferableRecords { * @return The record iterator */ Iterable<Record> records(); + + /** + * Return a slice of records from this instance, which is a view into this set starting from the given position + * and with the given size limit. + * + * If the size is beyond the end of the records, the end will be based on the size of the records at the time of the read. + * + * If this records set is already sliced, the position will be taken relative to that slicing. + * + * @param position The start position to begin the read from + * @param size The number of bytes after the start position to include + * @return A sliced wrapper on this message set limited based on the given position and size + */ + Records slice(int position, int size) throws IOException; Review Comment: I have made a separate [commit](https://github.com/apache/kafka/pull/19581/commits/7eb661be549a31ba2339ee556cc313b96679c482) in this PR which shows the changed to make MemoryRecords and FileRecords to return Record type. The casting is required at 1 place in DumpLogSegments.scala. Couple of cast is required in test file where I am validating `validBytes` in MemoryRecordTest. Otherwise the change looks good. ########## clients/src/main/java/org/apache/kafka/common/record/Records.java: ########## @@ -90,4 +91,18 @@ public interface Records extends TransferableRecords { * @return The record iterator */ Iterable<Record> records(); + + /** + * Return a slice of records from this instance, which is a view into this set starting from the given position + * and with the given size limit. + * + * If the size is beyond the end of the records, the end will be based on the size of the records at the time of the read. + * + * If this records set is already sliced, the position will be taken relative to that slicing. + * + * @param position The start position to begin the read from + * @param size The number of bytes after the start position to include + * @return A sliced wrapper on this message set limited based on the given position and size + */ + Records slice(int position, int size) throws IOException; Review Comment: I have made a separate [commit](https://github.com/apache/kafka/pull/19581/commits/7eb661be549a31ba2339ee556cc313b96679c482) in this PR which shows the changes to make MemoryRecords and FileRecords to return Record type. The casting is required at 1 place in DumpLogSegments.scala. Couple of cast is required in test file where I am validating `validBytes` in MemoryRecordTest. Otherwise the change looks good. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org