private Optional<Integer> maybeLeaderEpoch(int leaderEpoch) {
        return leaderEpoch == RecordBatch.NO_PARTITION_LEADER_EPOCH ? Optional.empty() : Optional.of(leaderEpoch);
    }
Stop the remote-log-manager task for the given partitions. And, calls the
{@link RemoteLogMetadataManager#onStopPartitions(Set)} when {@link StopPartition#deleteLocalLog()} is true.
Deletes the partitions from the remote storage when {@link StopPartition#deleteRemoteLog()} is true.

@param stopPartitions topic partitions that needs to be stopped.
@param errorHandler   callback to handle any errors while stopping the partitions.
core/src/main/java/kafka/log/remote/RemoteLogManager.java