AndrewJSchofield commented on code in PR #19581: URL: https://github.com/apache/kafka/pull/19581#discussion_r2063755306
########## 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: This part doesn't seem right to me. Neither `MemoryRecords` nor `FileRecords` implements a slice method which returns `Records`. There would be a bit more work required to make the concrete classes properly interchangeable so the caller didn't need to know which class they were dealing with. -- 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