public void truncateTo(long offset) throws IOException {
        ByteBuffer buffer = ByteBuffer.allocate(AbortedTxn.TOTAL_SIZE);
        OptionalLong newLastOffset = OptionalLong.empty();
        for (AbortedTxnWithPosition txnWithPosition : iterable(() -> buffer)) {
            AbortedTxn abortedTxn = txnWithPosition.txn;
            long position = txnWithPosition.position;
            if (abortedTxn.lastOffset() >= offset) {
                channel().truncate(position);
                lastOffset = newLastOffset;
                return;
            }
            newLastOffset = OptionalLong.of(abortedTxn.lastOffset());
        }
    }
Delete this index.

@throws IOException if deletion fails due to an I/O error
@return `true` if the file was deleted by this method; `false` if the file could not be deleted because it did
        not exist
storage/src/main/java/org/apache/kafka/storage/internals/log/TransactionIndex.java