flume/planner/pass_manager.cpp
// breadth-first search all related passes which are ready to run.
breadth-first search all related passes which are ready to run.
breadth - first search all related passes which are ready to run .
PassManager::PassSet PassManager::CollectReadyPasses(const PassSet& needed_passes) {
    PassSet processed_passes;
    std::deque<std::string> processing_queue(needed_passes.begin(), needed_passes.end());
    PassSet ready_passes;
    while (!processing_queue.empty()) {
        const std::string pass = processing_queue.front();
        processing_queue.pop_front();
        if (m_valid_passes.count(pass) != 0 || processed_passes.count(pass) != 0) {
            continue;
        }
        processed_passes.insert(pass);
        bool is_ready = true;
        PassMap::iterator ptr, end;
        for (boost::tie(ptr, end) = s_depend_map->equal_range(pass); ptr != end; ++ptr) {
            if (m_valid_passes.count(ptr->second) == 0) {
                processing_queue.push_back(ptr->second);
                is_ready = false;
            }
        }
        if (is_ready) {
            ready_passes.insert(pass);
        }
    }
    return ready_passes;
}
PassManager :: PassSet PassManager :: CollectReadyPasses ( const PassSet & needed_passes ) { PassSet processed_passes ; std :: deque < std :: string > processing_queue ( needed_passes . begin ( ) , needed_passes . end ( ) ) ; PassSet ready_passes ; while ( ! processing_queue . empty ( ) ) { const std :: string pass = processing_queue . front ( ) ; processing_queue . pop_front ( ) ; if ( m_valid_passes . count ( pass ) != 0 || processed_passes . count ( pass ) != 0 ) { continue ; } processed_passes . insert ( pass ) ; bool is_ready = true ; PassMap :: iterator ptr , end ; for ( boost :: tie ( ptr , end ) = s_depend_map -> equal_range ( pass ) ; ptr != end ; ++ ptr ) { if ( m_valid_passes . count ( ptr -> second ) == 0 ) { processing_queue . push_back ( ptr -> second ) ; is_ready = false ; } } if ( is_ready ) { ready_passes . insert ( pass ) ; } } return ready_passes ; }
breadth-first search all related passes which are ready to run.
breadth - first search all related passes which are ready to run .