public int numRecords() {
        return (int) (nextOffset - baseOffset);
    }
Get the number of records appended to the batch. This is updated after
each append.

@return the number of appended records
raft/src/main/java/org/apache/kafka/raft/internals/BatchBuilder.java