public static boolean isOnline(Uuid dir, List<Uuid> sortedOnlineDirs) {
        if (UNASSIGNED.equals(dir) || MIGRATING.equals(dir)) {
            return true;
        }
        if (LOST.equals(dir)) {
            return false;
        }

        // The only time we should have a size be 0 is if we were at a MV prior to 3.7-IV2
        // and the system was upgraded. In this case the original list of directories was purged
        // during broker registration, so we don't know if the directory is online. We assume
        // that a broker will halt if all its log directories are down. Eventually the broker
        // will send another registration request with information about all log directories.
        // Refer KAFKA-16162 for more information
        if (sortedOnlineDirs.isEmpty()) {
            return true;
        }
        return Collections.binarySearch(sortedOnlineDirs, dir) >= 0;
    }
Check if a directory is online, given a sorted list of online directories.
@param dir              The directory to check
@param sortedOnlineDirs The sorted list of online directories
@return                 true if the directory is considered online, false otherwise
server-common/src/main/java/org/apache/kafka/common/DirectoryId.java